FairRoot/PandaRoot
Functions
emc_complete_corr.C File Reference

Go to the source code of this file.

Functions

 emc_complete_corr (Int_t nEvents=10, Float_t mom=1.)
 

Function Documentation

emc_complete_corr ( Int_t  nEvents = 10,
Float_t  mom = 1. 
)

Modified 17.12.08 by M. Al-Turany The hit producing is added to the simulation session, so that the EmcHits are produced on the fly during the simulation

Set the digitization parameters

Get the run time data base for this session and set the needed input

Parameters created for this simulation goes to the out put

Add Hit producer task to the simulation

Initialize the session

After initialization now we can save the field parameters

All parameters are initialized and ready to be saved

Definition at line 9 of file emc_complete_corr.C.

References Bool_t, boxGen, Cave, ctime, digiFile, Double_t, Emc, emcDigiFile, emcHdrFiller, emcHitProd, emcHitsToWaveform, emcMakeBump, emcMakeCluster, emcMakeRecoHit, emcWaveformToDigi, fField, fRun, gDebug, kParameterMerged, Magnet, nEvents, output, Par, parFile, parIo1, Pipe, primGen, printf(), rootlogon(), rtdb, rtime, PndEmc::SetGeometryVersion(), PndMultiFieldPar::SetParameters(), PndEmcMakeCluster::SetStorageOfData(), PndEmcMakeBump::SetStorageOfData(), PndEmcHitsToWaveform::SetStorageOfData(), PndEmcWaveformToDigi::SetStorageOfData(), PndEmcMakeCorr::SetStorageOfData(), PndEmcHitProducer::SetStorageOfData(), PndEmc::SetStorageOfData(), timer, and TString.

9  {
10  TStopwatch timer;
11  timer.Start();
12  gDebug=0;
13  // Load basic libraries
14  // If it does not work, please check the path of the libs and put it by hands
15  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
16  rootlogon();
17 
18  FairRunSim *fRun = new FairRunSim();
19 
20  TString digiFile = "emc.par";
21 
22  TString parFile = "simparams.root";
23 
24  // set the MC version used
25  // ------------------------
26 
27  //fRun->SetName("TGeant3");
28  fRun->SetName("TGeant4");
29 
30  TString transportModel;
31 
32  transportModel = fRun->GetName();
33  cout<<"transport model = "<<transportModel <<endl;
34 
35  fRun->SetOutputFile("emc_complete_corr.root");
36 
37 
40  TString emcDigiFile = gSystem->Getenv("VMCWORKDIR");
41  emcDigiFile += "/macro/params/";
42  emcDigiFile += digiFile;
44  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
45  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
46  parIo1->open(emcDigiFile.Data(),"in");
47  rtdb->setFirstInput(parIo1);
49 
51  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
52  output->open("simparams.root");
53  rtdb->setOutput(output);
54 
55 
56  // Set Material file Name
57  //-----------------------
58  fRun->SetMaterials("media_pnd.geo");
59 
60  // Create and add detectors
61  //-------------------------
62  FairModule *Cave= new PndCave("CAVE");
63  Cave->SetGeometryFileName("pndcave.geo");
64  fRun->AddModule(Cave);
65 
66  FairModule *Magnet= new PndMagnet("MAGNET");
67  Magnet->SetGeometryFileName("magnet.geo");
68  fRun->AddModule(Magnet);
69 
70  FairModule *Pipe= new PndPipe("PIPE");
71  Pipe->SetGeometryFileName("pipe.geo");
72  fRun->AddModule(Pipe);
73 
74  PndEmc *Emc = new PndEmc("EMC",kTRUE);
75  //new BwEndCap + FwEndCap
76  //Emc->SetGeometryFileNameTriple("emc_module125.dat","emc_module3new.root","emc_module4_StraightGeo24.4.root"); //MapperVersion: 6
77  Emc->SetGeometryVersion(15);
78  Emc->SetStorageOfData(kFALSE);
79  fRun->AddModule(Emc);
80 
81  // Create and Set Event Generator
82  //-------------------------------
83 
84  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
85  fRun->SetGenerator(primGen);
86 
87  TString part="gamma";
88  cout <<" part = "<< part<<endl;
89  TDatabasePDG *pdg = new TDatabasePDG();
90  Int_t part_pid = pdg->GetParticle(part)->PdgCode();
91 
92  cout <<"pid == "<< part_pid<<endl;
93 
94  // Box Generator:
95  FairBoxGenerator* boxGen = new FairBoxGenerator(part_pid, 5); // 13 = muon; 1 = multipl. // 211 = pi+
96  // first number: PDG particle code: 2nd number: particle multiplicity per event
97 
98  boxGen->SetPRange(1.,1.); // GeV/c
99  // boxGen->SetPtRange(1.,1.); // GeV/c
100  boxGen->SetPhiRange(0., 360.); // Azimuth angle range [degree]
101  boxGen->SetThetaRange(0., 180.); // Polar angle in lab system range [degree]
102  boxGen->SetXYZ(0., 0., 0.); // vertex coordinates [mm]
103  primGen->AddGenerator(boxGen);
104 
105  // fRun->SetStoreTraj(kTRUE); // to store particle trajectories
106  fRun->SetBeamMom(15);
107  //---------------------Create and Set the Field(s)----------
108  PndMultiField *fField= new PndMultiField("FULL");
109  fRun->SetField(fField);
110 
115  emcHitProd->SetStorageOfData(kFALSE);
116  fRun->AddTask(emcHitProd);
117 
120  emcHitsToWaveform->SetStorageOfData(kFALSE);
121  emcWaveformToDigi->SetStorageOfData(kFALSE);
122  fRun->AddTask(emcHitsToWaveform); // full digitization
123  fRun->AddTask(emcWaveformToDigi); // full digitization
124 
126  emcMakeCluster->SetStorageOfData(kFALSE);
127  fRun->AddTask(emcMakeCluster);
128 
130  fRun->AddTask(emcHdrFiller); // ECM header
131 
133  emcMakeBump->SetStorageOfData(kFALSE);
134  fRun->AddTask(emcMakeBump);
135 
137  fRun->AddTask(emcMakeRecoHit);
138 
139  cout<< "emc_complete.C --> BEFORE corrections "<<endl;
140  // ========================================================================
141  PndEmcMakeCorr* emcCorrection= new PndEmcMakeCorr(2,transportModel);
142  emcCorrection->SetStorageOfData(kFALSE);
143  fRun->AddTask(emcCorrection);
144  // ========================================================================
145 
146 
148  fRun->Init();
149  //PndEmcMapper *emcMap = PndEmcMapper::Instance(6);
151  PndMultiFieldPar* Par = (PndMultiFieldPar*) rtdb->getContainer("PndMultiFieldPar");
152  if (fField) { Par->SetParameters(fField); }
153  Par->setInputVersion(fRun->GetRunId(),1);
154  Par->setChanged();
155 
157  rtdb->saveOutput();
158  // rtdb->print();
159 
160  // Transport nEvents
161  // -----------------
162  cout <<" nEvents == "<<nEvents<<endl;
163  fRun->Run(nEvents);
164  cout <<" ***done == "<<endl;
165  timer.Stop();
166 
167  Double_t rtime = timer.RealTime();
168  Double_t ctime = timer.CpuTime();
169  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
170 
171 }
Takes list of PndEmcHits and creates PndEmcWaveform.
PndMultiField * fField
Definition: sim_emc_apd.C:97
void SetStorageOfData(Bool_t val)
Method to specify whether clusters are stored or not.
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
Create PndEmcRecoHit from PndEmcBump.
PndEmcHitsToWaveform * emcHitsToWaveform
Definition: full_emc.C:60
Bool_t kParameterMerged
Definition: sim_emc_apd.C:113
void SetParameters(FairField *field)
PndEmcMakeRecoHit * emcMakeRecoHit
creates PndEmcHits from PndEmcPoints
PndEmc * Emc
Definition: sim_emc_apd.C:55
TString digiFile
Definition: bump_emc.C:20
void SetStorageOfData(Bool_t val)
Definition: PndEmc.cxx:941
PndEmcMakeBump * emcMakeBump
Definition: bump_emc.C:63
TString emcDigiFile
Definition: bump_emc.C:45
FairParRootFileIo * output
Definition: sim_emc_apd.C:120
Simulation of EMC.
Definition: PndEmc.h:26
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
PndEmcHdrFiller * emcHdrFiller
Definition: full_emc.C:68
FairRunAna * fRun
Definition: hit_dirc.C:58
void SetStorageOfData(Bool_t val)
void SetStorageOfData(Bool_t val)
Double_t
TString parFile
Definition: hit_dirc.C:14
FairModule * Cave
Definition: sim_emc_apd.C:32
PndEmcMakeCluster * emcMakeCluster
Definition: full_emc.C:65
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
virtual void SetGeometryVersion(const Int_t GeoNumber)
Definition: PndEmc.cxx:966
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
gDebug
Definition: sim_emc_apd.C:6
void SetStorageOfData(Bool_t val)
PndEmcHitProducer * emcHitProd
void SetStorageOfData(Bool_t val)
Method to specify whether bumps are stored or not.
Takes clusters and slits them up into bumps.
Double_t ctime
Definition: hit_dirc.C:114
PndEmcWaveformToDigi * emcWaveformToDigi
Definition: full_emc.C:61
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
FairBoxGenerator * boxGen
Definition: sim_emc_apd.C:85
Task to cluster PndEmcDigis.
PndMultiFieldPar * Par
Definition: sim_emc_apd.C:115
Takes list of PndEmcWaveform and creates PndEmcDigi.
FairModule * Pipe
Definition: sim_emc_apd.C:44
Double_t rtime
Definition: hit_dirc.C:113
void SetStorageOfData(Bool_t val)
Task to create Emc header.
FairModule * Magnet
Definition: sim_emc_apd.C:36
Definition: PndCave.h:8