FairRoot/PandaRoot
Functions
run_test.C File Reference

Go to the source code of this file.

Functions

int run_test (TString prefix="", Int_t nEvents=2000, TString Decfile="box", TString vers="current", Bool_t HYP_File=false, Bool_t gam=false)
 

Function Documentation

int run_test ( TString  prefix = "",
Int_t  nEvents = 2000,
TString  Decfile = "box",
TString  vers = "current",
Bool_t  HYP_File = false,
Bool_t  gam = false 
)

data/work/kpha4/lorente/sim_panda/Sim_hypFSG41TXm_GB.root");

data/work/kpha4/lorente/sim_panda/Sim_hypFS1TG4Xm_GBparams.root");

rtdb->print();

Definition at line 18 of file run_test.C.

References AsciiGen, Bool_t, boxGen, Cave, ctime, Double_t, fieldPar, fMagField, fRun, gam, PndHypBupGenerator::GammaEmissPar(), gDebug, Hyp, inFile, kParameterMerged, nEvents, output, partGen, primGen, printf(), rtdb, rtime, PndHyp::SetAbsorberVol(), PndConstField::SetField(), PndConstField::SetFieldRegion(), PndHyp::SetGeoVersion(), PndHyp::SetHypGamFEm(), PndHyp::SetHypSDtoFile(), PndHyp::SetListMat(), PndCorrDistGenerator::SetParam(), PndConstPar::SetParameters(), PndBoxGenerator::SetPhiRange(), PndHypBupGenerator::SetPhiRange(), PndBoxGenerator::SetPRange(), PndHypBupGenerator::SetPRange(), PndHyp::SetSensorVol(), PndCorrDistGenerator::SetThetaRange(), PndHypBupGenerator::SetThetaRange(), PndBoxGenerator::SetThetaRange(), PndHyp::SetTreeFName(), PndBoxGenerator::SetXYZ(), timer, and TString.

18  {
19  TStopwatch timer;
20  timer.Start();
21  gRandom->SetSeed();
22  gDebug=0;
23 
24  //gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
25 
26 
27  gSystem->Load("libtrackrep");
28 
29 
30  gSystem->Load("librazhyp");
31  gSystem->Load("libHyp");
32 
33  FairRunSim *fRun = new FairRunSim();
34 
35  // --- first step ----
37  //Background
38 
39  if(Decfile=="giBUU+backg")inFile= "/data/work/kpha4/lorente/sim_panda/carbon2_allParticles_1_32.root";
40 
41  // -- GiBUU Parametrization TH2F Corr. Dist P(theta)
42 
43  if(Decfile=="hist"||Decfile=="param")inFile= "XiGengiBUUSamp.root";
44 
45  //--Second xi minus momentum solution.
46 
47  //TString inFile= "data/xibximin2AStpRate.dat";//data/ximinAsciiStpRate.dat";
48  //TString inFile= "data/ximinAsciiStpRate.dat";
49 
50  // -- UrqmdSmm/GiBUU SIGNAL/ background events
51 
52  // Int_t nEvents =99480;
53 
54  if(Decfile=="giBUU")inFile= "../../../../../FairFeb14/pandaroot/macro/hyp/Alicia/carbon_onlyXi_2_5.root";//"/data/work/kpha4/lorente/XiProduction/UrQMDSmmXiXib/apC_potP1.root";
55 
56  //--- second step --
57  //--- HF from vertexes ----
58 
59  if(Decfile=="hypbup"){
60 
61  if(gam){
62  inFile= "/data/work/kpha4/lorente/sim_panda/hypBupV1T_Decay_gam_"+prefix+".root";
63  }else{
64  inFile= "hypBupV1T_Decay_3.root";
65  }
66  }
67 
68 
69  // set the MC version used
70 
71 
72 
73  // ------------------------
74 
75  fRun->SetName("TGeant4");
76 
77 
78 
79  // ----------first step -------------
80 
81  // --------- background ------------
82 
83  if(Decfile=="giBUU+backg")fRun->SetOutputFile("/data/work/kpha4/lorente/sim_panda/Sim_hypFSG41TBg_SebGeo_"+prefix+".root");
84  //----------------------------------
85 
86  // ++++++ Xi minus production ++++++
87  if(Decfile=="box")fRun->SetOutputFile("sim_box.root");
88  if(Decfile=="param")fRun->SetOutputFile("/data/work/kpha4/lorente/sim_panda/Sim_hypFSG41TXm_SebGeo_"+prefix+".root");
89  if(Decfile=="giBUU") fRun->SetOutputFile("sim_gibuu.root");
90  // ----------first step XXb production -----------------------
91 
92  //fRun->SetOutputFile("Sim_hypFSG41TXXb_Geo2.root");
93 
94  // ---------- second step HF decay from secondary vertexes -------
95 
96  //fRun->SetOutputFile("Bup_hypFSG41TXXb.root");
97  if(Decfile=="hypbup")fRun->SetOutputFile("Bup_hypFSG41TXm.root");
98 
99 
100  // Set Material file Name
101  //-----------------------
102 
103  //fRun->SetMaterials("media_pnd_hyp.geo");
104  //new media for hyp
105  fRun->SetMaterials("media_pnd.geo");
106 
107  // Create and add detectors
108  //-------------------------
109 
110  FairModule *Cave= new PndCave("CAVE");
111  Cave->SetGeometryFileName("pndcave.geo");
112  fRun->AddModule(Cave);
113  /*
114  FairModule *Magnet= new FairMagnet("MAGNET");
115  Magnet->SetGeometryFileName("magnet.geo");
116  fRun->AddModule(Magnet);
117  */
118 
119 
120 
121  PndHyp *Hyp = new PndHyp("HYP",kTRUE);
122  //FairDetector *Hyp = new PndHyp("HYP",kTRUE);
123 
124  //Hyp->SetGeometryFileName("HypST_block.geo");
125  //fRun->AddModule(Hyp);
126  //--blocks
127  //---Layers (si+abs)
128  //Hyp->SetGeometryFileName("HypST_prueba2.geo");
129  //fRun->AddModule(Hyp);
130  //--layers C+Si
131  // Hyp->SetGeometryFileName("HypST_prueba23.geo");
132  //fRun->AddModule(Hyp);
133  //--layers C+si+hyppipe
134  //Hyp->SetGeometryFileName("HypST_prueba24pipe.geo");
135  //Hyp->SetGeometryFileName("HypST_newxy3C.geo");
136 
137 
138 
139  // --- root geometry ------
140  // xxxxx Alicia's detector geo xxxx
141  if(vers=="standard"){
142 
143  Hyp->SetAbsorberVol("stglAb"); // absorber layer
144  Hyp->SetSensorVol("stglSi"); // silicon sensor
145  Hyp->SetGeoVersion("List");
146  Hyp->SetListMat("HYPdiamond");
147  Hyp->SetListMat("HYPcarbon");
148  //Hyp->SetGeometryFileName("HYPST_assexy3C5Lay.root");
149  Hyp->SetGeometryFileName("HYPST_assexy3C5Lay_mvd.root");//HYPST_assexy3C5Lay_test.root");
150 
151  }
152 
153  // xxxxxxxx Sebastian asymmetric geo root xxxxxxxxxxx
154  if(vers=="current"){
155  Hyp->SetAbsorberVol("Absorber"); // absorber layer
156  Hyp->SetSensorVol("Sensor"); // silicon sensor
157  Hyp->SetGeoVersion("List");
158  Hyp->SetListMat("HYPboron");
159  Hyp->SetListMat("HYPaluminium");
160  Hyp->SetListMat("Al97Mg3");
161  Hyp->SetListMat("titanium");
162  Hyp->SetListMat("HYPcarbon");
163  Hyp->SetListMat("siliconinactive");
164  Hyp->SetGeometryFileName("TargetSystem_Ti_TcT150um_filledCorners_addSens.root");
165  //Hyp->SetGeometryFileName("TargetSystem_Ti_AbsWindow_addSens.root");//SekTarget_open_varAbs4Si5_3Q_HYPbe_1mm_MVD.root");
166  }
167 
168  // ---------------------------------
169 
170  if(HYP_File){
171 
172  Hyp->SetHypSDtoFile(true,HYP_File);
173 
174  if(gam){
175  Hyp->SetHypGamFEm(gam);
176  Hyp->SetTreeFName("/data/work/kpha4/lorente/sim_panda/hypBupV1T_Decay_gam_"+prefix+".root");
177  }else{
178  Hyp->SetTreeFName("hypBupV1T_Decay_3.root");
179  }
180  }
181  fRun->AddModule(Hyp);
182 
183  //gROOT->LoadMacro("$VMCWORKDIR/gconfig/SetFragments.C");
184  //FragConfig(fRun);
185 
186  //fRun->SetUserDecay(kTRUE);
187 
188  // MVD outer structure
189  //--------------------
190 
191  /* FairDetector *Mvd = new PndMvdDetector("MVD", kTRUE);
192  Mvd->SetGeometryFileName("Mvd-2.2_Simplified_onlyStrip5_z-verschoben550.root"); // only sensors, update follows
193  Mvd->SetVerboseLevel(verboseLevel);
194  fRun->AddModule(Mvd);*/
195 
196  // Create and Set Event Generator
197  //-------------------------------
198 
199 
200 
201  if(Decfile=="giBUU+backg"){
203  fRun->SetGenerator(primGen);
204  }else{
205  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
206  fRun->SetGenerator(primGen);
207  }
208 
209  // Box Generator:
210  if(Decfile=="box"){
211  PndBoxGenerator* boxGen = new PndBoxGenerator(3312, 1); // 13 = muon; 1 = multipl. // 211 = pi+
212  // first number: PDG particle code: 2nd number: particle multiplicity per event
213 
214  boxGen->SetPRange(.1,.5); // GeV/c
215  // boxGen->SetPtRange(1.,1.); // GeV/c
216  boxGen->SetPhiRange(0., 360.); // Azimuth angle range [degree] 90
217  boxGen->SetThetaRange(0., 180.); // Polar angle in lab system range [degree] 70
218 
219  boxGen->SetXYZ(0., 0., -55.0); // vertex coordinates [cm]
220  primGen->AddGenerator(boxGen);
221  }
222 
223 
224  // *** Signal events GiBUU + TH2F(correlated dist in P (theta)) ***first step
225  if(Decfile=="hist"){
226  PndCorrDistGenerator* GiBGen = new PndCorrDistGenerator(inFile);
227 
228  primGen->SetTarget(-55.5,0.);
229  primGen->AddGenerator(GiBGen);
230 
231  }
232  // *** Signal events GiBUU + Param from TH2F(correlated dist in P (theta)) ***first step
233  if(Decfile=="param"){
234  PndCorrDistGenerator* GiBGen = new PndCorrDistGenerator(inFile);
235  GiBGen->SetParam(); //setting parametrization to be be done.
236  GiBGen->SetThetaRange(90.,120.); // low momentum Xi minus
237  primGen->SetTarget(-55.5,0.);
238  primGen->AddGenerator(GiBGen);
239 
240  }
241  // *** SIGNAL events UrqmdSmm ***first step
242  if(Decfile=="giBUU"){
243 
245 
246  primGen->SetTarget(-55.5,0.);
247  primGen->AddGenerator(AsciiGen);
248  }
249 
250  if(Decfile=="giBUU+backg"){
251 
252  PndUrqmdSmmGenerator* AsciiGen = new PndUrqmdSmmGenerator(inFile);
253 
254  primGen->SetTarget(-55.5,0.);
255  primGen->AddGenerator(AsciiGen);
256  FairEvtFilterOnCounts* min1Lmd_1aLmd = new FairEvtFilterOnCounts();
257  min1Lmd_1aLmd->AndMinMaxPdgCodes(1, 9999, 3312); // request at least 1 Xim
258  min1Lmd_1aLmd->AndMinMaxPdgCodes(1, 9999, -3312); // request at least 1 anti-Xi plus
259  primGen->AndNotFilter(min1Lmd_1aLmd);
260  }
261 
262  // *** with Ascii inFile ***first step
263  //FairAsciiGenerator* AsciiGen = new FairAsciiGenerator(inFile);
264  // primGen->SetTarget(-55.5,0.);
265  //primGen->AddGenerator(AsciiGen);
266 
267  // *** with root inFile ***second step
268  if(Decfile=="hypbup"){
269 
271 
272  if(gam){
273  partGen->GammaEmissPar(kTRUE);
274  partGen->SetPRange(1.,1.);
275  partGen->SetPhiRange(0,360);
276  partGen->SetThetaRange(0,180);
277  }
278  primGen->AddGenerator(partGen);
279  }
280 
281 
282 
283 
285  fMagField->SetField(0, 0 ,10. ); // values are in kG
286  // MinX=-75, MinY=-40,MinZ=-12 ,MaxX=75, MaxY=40 ,MaxZ=124 ); // values are in cm
287  fMagField->SetFieldRegion(-50, 50,-50, 50, -200, 200);
288  fRun->SetField(fMagField);
289 
290 
291  /*PndMultiField *fField= new PndMultiField();
292  PndTransMap *map= new PndTransMap("TransMap", "R");
293  PndDipoleMap *map1= new PndDipoleMap("DipoleMap", "R");
294  PndSolenoidMap *map2= new PndSolenoidMap("SolenoidMap", "R");
295  fField->AddField(map);
296  fField->AddField(map1);
297  fField->AddField(map2);
298  fRun->SetField(fField);*/
299 
300  fRun->SetStoreTraj(kTRUE); // to store particle trajectories
301 
302 
303  fRun->Init();
304 
305 
306 
307  // Fill the Parameter containers for this run
308  //-------------------------------------------
309  // cout<<" gGeoManager "<<gGeoManager<<endl;
310  FairRuntimeDb *rtdb=fRun->GetRuntimeDb();
311 
312  // PndMultiFieldPar* fieldPar = (PndMultiFieldPar*) rtdb->getContainer("PndMultiFieldPar");
313  // if ( fField ) { fieldPar->SetParameters(fField); }
314  // fieldPar->setInputVersion(fRun->GetRunId(),1);
315  // fieldPar->setChanged();
316 
317  PndConstPar* fieldPar = (PndConstPar*) rtdb->getContainer("PndConstPar");
318  if ( fMagField ) { fieldPar->SetParameters(fMagField); }
319  fieldPar->setInputVersion(fRun->GetRunId(),1);
320  fieldPar->setChanged();
321 
322  Bool_t kParameterMerged=kTRUE;
323  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
324  //output->open("simparams.root");
325  if(Decfile=="param") output->open("/data/work/kpha4/lorente/sim_panda/Sim_hypFS1TG4Xm_SebGeo3params_"+prefix+".root");
326  if(Decfile=="giBUU") output->open("sim_gibuuparams.root");
327  if(Decfile=="box") output->open("sim_boxparams.root");
328  //output->open("Bup_hypFS1TG4XXbparams.root");
329  if(Decfile=="hypbup")output->open("Bup_hypFS1TG4Xmparams.root");
330 
331  if(Decfile=="giBUU+backg")output->open("/data/work/kpha4/lorente/sim_panda/Sim_hypFS1TG4Bg_SebGeoparams_"+prefix+".root");
332 
333  rtdb->setOutput(output);
334 
336 
337  // Transport nEvents
338  // -----------------
339  // Set the number of events
340  //Int_t nEvents =1000;//1002;//50505;
341 
342  fRun->Run(nEvents);
343  rtdb->saveOutput();
344  timer.Stop();
345 
346  Double_t rtime = timer.RealTime();
347  Double_t ctime = timer.CpuTime();
348  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
349  // delete fRun;
350  //exit(0);
351  return 0;
352 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
void SetThetaRange(Double32_t thetamin=0, Double32_t thetamax=90)
void SetListMat(TString mat="carbon")
Definition: PndHyp.h:222
Definition: PndHyp.h:30
Bool_t kParameterMerged
Definition: sim_emc_apd.C:113
void SetXYZ(Double32_t x=0, Double32_t y=0, Double32_t z=0)
PndHyp * Hyp
Definition: runSimHF_ptr.C:73
PndUrqmdSmmGenerator * AsciiGen
Definition: sim_ftof.C:62
PndHypBupGenerator * partGen
Definition: runSimHF_ptr.C:144
void SetPRange(Double32_t pmin=0, Double32_t pmax=10)
FairParRootFileIo * output
Definition: sim_emc_apd.C:120
void SetFieldRegion(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
void SetSensorVol(TString VolSi)
Definition: PndHyp.h:195
FairRunAna * fRun
Definition: hit_dirc.C:58
TString inFile
Definition: hit_dirc.C:8
PndConstField * fMagField
Definition: runSimHF_ptr.C:154
Primary generator with added event filtering capabilities.
void SetHypSDtoFile(bool onf, bool val)
Definition: PndHyp.h:177
Double_t
FairModule * Cave
Definition: sim_emc_apd.C:32
void SetField(Double_t bX, Double_t bY, Double_t bZ)
Int_t nEvents
Definition: hit_dirc.C:11
PndMultiFieldPar * fieldPar
Definition: sim_ftof.C:102
TStopwatch timer
Definition: hit_dirc.C:51
void SetHypGamFEm(bool gam)
Definition: PndHyp.h:183
void SetAbsorberVol(TString VolAb)
Definition: PndHyp.h:199
void SetParameters(FairField *field)
Definition: PndConstPar.cxx:54
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void SetTreeFName(const Char_t *Name)
Definition: PndHyp.h:193
gDebug
Definition: sim_emc_apd.C:6
void SetThetaRange(Double_t thetLow=0., Double_t thetHigh=0.)
CandList gam
void SetPhiRange(Double32_t phimin=0, Double32_t phimax=360)
Double_t ctime
Definition: hit_dirc.C:114
FairBoxGenerator * boxGen
Definition: sim_emc_apd.C:85
void SetGeoVersion(TString vers="standard")
Definition: PndHyp.h:210
void SetThetaRange(Double32_t thetamin=0, Double32_t thetamax=90)
void SetPRange(Double32_t pmin=0, Double32_t pmax=10)
Double_t rtime
Definition: hit_dirc.C:113
void SetPhiRange(Double32_t phimin=0, Double32_t phimax=360)
Definition: PndCave.h:8