1 #if !defined(__CINT__) && !defined(__CLING__)
13 #include "TClassTable.h"
15 #include "TDataSetIter.h"
16 #include "StBFChain.h"
17 void bfc (
const Int_t Last,
20 const Char_t *outfile,
21 const Char_t *TreeFile);
24 #define SETBIT(n,i) ((n) |= (1 << i))
25 #define CLRBIT(n,i) ((n) &= ~(1 << i))
32 void TpcRS(Int_t
First, Int_t
Last,
const Char_t *Run =
"y2011,TpcRS",
33 const Char_t *fileIn = 0,
const Char_t *opt =
"Bichsel",
const Char_t *kuip = 0,
34 const Char_t *fileOut = 0) {
35 gROOT->LoadMacro(
"bfc.C");
37 TString RootFile(fileOut);
42 if (RunOpt.Contains(
"y2005",TString::kIgnoreCase)) {
44 ChainOpt =
"ry2005b,in,tpcI,Physics,Idst,l0,tags,Tree,evout,IAna,fcf,VFMinuit,emcDY2,";
45 ChainOpt+=
"ftpc,trgd,ZDCvtx,Corr3,DbV20060421,useCDV,ITTF,tofDat,NosstIT,NosvtIT,SCEbyE,OGridLeak,OShortR,OSpaceZ2,TpxClu,TpxRaw";
46 ChainOpt+=
",useInTracker";
47 ChainOpt +=
",McTpcAna,";
48 }
else if ( RunOpt.Contains(
"RC.y",TString::kIgnoreCase) ||
49 RunOpt.Contains(
"MC.y",TString::kIgnoreCase)) {
51 ChainOpt +=
",MakeEvent,ITTF,NoSsdIt,NoSvtIt,Idst,VFMinuit,analysis,dEdxY2";
56 ChainOpt +=
",CMuDst,IdTruth,useInTracker,tree,StiKFVertex,xgeometry,";
57 ChainOpt +=
"bbcSim,btofsim,btofMatch,btofCalib,";
58 ChainOpt +=
"EvOut,-hitfilt,";
59 ChainOpt +=
"McTpcAna,";
62 if (TString(gSystem->Getenv(
"STAR_VERSION")) ==
".DEV2" ||
63 TString(gSystem->Getenv(
"STAR_VERSION")) ==
"SL11d_embed") ChainOpt +=
"NoHistos,NoRunco,noTags,";
64 else ChainOpt +=
"tags,";
68 if (RunOpt.Contains(
"fcf",TString::kIgnoreCase)) {
69 ChainOpt +=
"tpl,tpcI,";
70 RunOpt.ReplaceAll(
"TpcRS,",
"");
71 RunOpt.ReplaceAll(
"trs,",
"");
73 ChainOpt +=
",tpcDB,TpcHitMover,TpxClu,";
76 TString FileIn(fileIn);
77 if (FileIn ==
"" && fileOut == 0) {
78 if (RunOpt.Contains(
"pythia",TString::kIgnoreCase)) {
80 }
else if (RunOpt.Contains(
"hijing",TString::kIgnoreCase)) {
83 ChainOpt +=
"gstar,"; RootFile +=
"gstar";
85 if (RunOpt.Contains(
"hadr_of",TString::kIgnoreCase) ||
86 Opt.Contains(
"hadr_of",TString::kIgnoreCase)) ChainOpt +=
"hadr_off,";
87 if (RunOpt.Contains(
"phys_of",TString::kIgnoreCase) ||
88 Opt.Contains(
"phys_of",TString::kIgnoreCase)) ChainOpt +=
"phys_off,";
89 if (RunOpt.Contains(
"PhysicsOff",TString::kIgnoreCase) ||
90 Opt.Contains(
"PhysicsOff",TString::kIgnoreCase)) ChainOpt +=
"phys_off,";
91 if (Opt.Contains(
"FieldOff" ,TString::kIgnoreCase)) ChainOpt +=
"FieldOff,";
92 else if (Opt.Contains(
"HalfField",TString::kIgnoreCase)) ChainOpt +=
"HalfField,";
93 else ChainOpt +=
"FieldOn,";
95 RootFile += Form(
"%s",gSystem->BaseName(FileIn.Data()));
96 if (FileIn.Contains(
".daq",TString::kIgnoreCase)) {
97 ChainOpt +=
"in,TpxRaw,";
98 RootFile.ReplaceAll(
".daq",
"");
99 }
else if (FileIn.Contains(
".fz",TString::kIgnoreCase)) {
101 RootFile.ReplaceAll(
".fzd",
"");
102 RootFile.ReplaceAll(
".fz",
"");
103 }
else if (FileIn.Contains(
".nt",TString::kIgnoreCase)) {
105 RootFile.ReplaceAll(
".nt",
"");
106 RootFile.ReplaceAll(
".",
"_");
107 }
else if (FileIn.Contains(
".geant.root",TString::kIgnoreCase)) {
109 RootFile.ReplaceAll(
".geant.root",
"");
110 }
else if (FileIn.Contains(
".MuDst",TString::kIgnoreCase)) {
112 RootFile.ReplaceAll(
".MuDst.root",
"");
114 if (gSystem->AccessPathName(FileIn.Data())) FileIn =
"";
118 RootFile += Form(
"_%s_%i_%i",Opt.Data(),
First,
Last);
119 RootFile.ReplaceAll(
".root",
"");
120 RootFile.ReplaceAll(
",",
"_");
121 if (RootFile.Contains(
";")) {
122 Int_t index = RootFile.Index(
";");
123 RootFile = RootFile(0,index);
126 RootFile.ReplaceAll(
" ",
"");
127 cout <<
"ChainOpt : " << ChainOpt.Data() <<
"\tOuput file " << RootFile.Data() << endl;
129 bfc(-1,ChainOpt.Data(),0,0,0);
133 TString output = RootFile;
135 output.ReplaceAll(
".root",
"O.root");
136 output.ReplaceAll(
"*",
"");
137 if (RunOpt.Contains(
"devT,",TString::kIgnoreCase)) ChainOpt +=
",useXgeom";
138 bfc(-1,ChainOpt.Data(),fileIn,output.Data(),RootFile.Data());
139 if (ChainOpt.Contains(
"TpcRS",TString::kIgnoreCase)) {
143 Int_t
m_Mode = tpcRS->GetMode();
144 if (Opt.Contains(
"heed",TString::kIgnoreCase)) {SETBIT(m_Mode,StTpcRSMaker::kHEED); CLRBIT(m_Mode,StTpcRSMaker::kBICHSEL);}
145 if (Opt.Contains(
"bichsel",TString::kIgnoreCase)) {SETBIT(m_Mode,StTpcRSMaker::kBICHSEL); CLRBIT(m_Mode,StTpcRSMaker::kHEED);}
146 if (! ChainOpt.Contains(
"Corr",TString::kIgnoreCase)) {CLRBIT(m_Mode,StTpcRSMaker::kDistortion);}
147 tpcRS->SetMode(m_Mode);
152 if (ChainOpt.Contains(
"trs",TString::kIgnoreCase)) {
153 StMaker *mk = chain->Maker(
"tpcDB");
159 StMaker *dEdxY2 = chain->GetMaker(
"dEdxY2");
173 SETBIT(mask,StTpcdEdxCorrection::ktpcPressure);
177 SETBIT(mask,StTpcdEdxCorrection::kAdcCorrection);
178 SETBIT(mask,StTpcdEdxCorrection::kTpcSecRow);
179 SETBIT(mask,StTpcdEdxCorrection::kDrift);
180 SETBIT(mask,StTpcdEdxCorrection::kzCorrection);
181 SETBIT(mask,StTpcdEdxCorrection::kdXCorrection);
184 SETBIT(mask,StTpcdEdxCorrection::kAdcCorrection);
185 SETBIT(mask,StTpcdEdxCorrection::kTpcLast);
189 SETBIT(Mode,StdEdxY2Maker::kPadSelection);
190 SETBIT(Mode,StdEdxY2Maker::kCalibration);
192 SETBIT(Mode,StdEdxY2Maker::kZBGX);
193 SETBIT(Mode,StdEdxY2Maker::kGASHISTOGRAMS);
198 cout <<
" set dEdxY2 Mode" << Mode <<
" =======================================" << endl;
202 cout <<
" set dEdxY2 mask " << mask <<
" =======================================" << endl;
207 if (Last < 0)
return;
208 Int_t initStat = chain->Init();
210 cout <<
"Chain initiation has failed" << endl;
211 chain->Fatal(initStat,
"during Init()");
213 if (gClassTable->GetID(
"TGiant3") >= 0) {
217 cout <<
"Options: " << Opt.Data() <<
"=========================================================" << endl;
222 }
else if ( RunOpt.Contains(
"Mickey",TString::kIgnoreCase)) {
223 }
else if ( Opt.Contains(
"laser",TString::kIgnoreCase)) {
224 gSystem->Load(
"gstar.so");
225 geant->
Do(
"call gstar");
226 geant->
Do(
"gkine 1 170 1 1 0 0 0 0 180.00 180.00;");
227 geant->
Do(
"gprint kine");
228 geant->
Do(
"gvert 0 54 0");
229 geant->
Do(
"mode TRAC prin 15");
230 }
else if (TString(geant->SAttr(
"GeneratorFile")) ==
"") {
236 Double_t Phihigh= 2*TMath::Pi();
239 Double_t mass = 0.1057;
240 Double_t bgMin = 1e-1;
241 Double_t bgMax = 1e6;
244 if (Opt.Contains(
"muon",TString::kIgnoreCase)) {ID = 5;
245 if (Opt.Contains(
"muon-",TString::kIgnoreCase)) ID = 6;}
246 else if (Opt.Contains(
"electron",TString::kIgnoreCase)) {ID = 3; mass = 0.5110E-03;}
247 else if (Opt.Contains(
"positron",TString::kIgnoreCase)) {ID = 2; mass = 0.5110E-03;}
248 else if (Opt.Contains(
"pion",TString::kIgnoreCase)) {ID = 8; mass = 0.1396;
249 if (Opt.Contains(
"pion-",TString::kIgnoreCase)) ID = 9;}
250 else if (Opt.Contains(
"kaon",TString::kIgnoreCase)) {ID = 11; mass = 0.4937;
251 if (Opt.Contains(
"kaon-",TString::kIgnoreCase)) ID = 12;}
252 else if (Opt.Contains(
"proton",TString::kIgnoreCase)) {ID = 14; mass = 0.9383;
253 if (Opt.Contains(
"antiproton",TString::kIgnoreCase) ||
254 Opt.Contains(
"pbar",TString::kIgnoreCase)) ID = 15;}
255 else if (Opt.Contains(
"deuteron",TString::kIgnoreCase)) {ID = 45; mass = 1.876;}
256 else if (Opt.Contains(
"triton",TString::kIgnoreCase)) {ID = 46; mass = 2.80925;}
257 else if (Opt.Contains(
"He3",TString::kIgnoreCase)) {ID = 49; mass = 2.80925;}
258 else if (Opt.Contains(
"alpha",TString::kIgnoreCase)) {ID = 47; mass = 3.727;}
259 else if (Opt.Contains(
"phi",TString::kIgnoreCase)) {ID = 10151; mass = 1.0194; NTRACK = 1; pTmin = 0.010, pTmax = 2.000;}
260 if (Opt.Contains(
"MIP",TString::kIgnoreCase)) { pTmin = 0.2; pTmax = 0.5; bgMin = 3; bgMax = 5;}
261 if (Opt.Contains(
"MIP1",TString::kIgnoreCase)) {NTRACK = 5;pTmin = 0.2; pTmax = 0.5; bgMin = 3; bgMax = 5;}
262 if (Opt.Contains(
"1GeV",TString::kIgnoreCase)) {pTmin = pTmax = 1.0;}
263 if (Opt.Contains(
"0.5GeV",TString::kIgnoreCase)) {pTmin = pTmax = 0.5;}
264 if (Opt.Contains(
"50",TString::kIgnoreCase)) {NTRACK = 50;}
265 if (Opt.Contains(
"1000",TString::kIgnoreCase)) {NTRACK = 1000;}
266 if (Opt.Contains(
"1muon",TString::kIgnoreCase)) NTRACK = 1;
267 if (Opt.Contains(
"Single",TString::kIgnoreCase)) NTRACK = 1;
268 if (Opt.Contains(
"LamXi2430",TString::kIgnoreCase)) {NTRACK = 50; ID = 60002; pTmin = 0.1; pTmax = 10.0;}
269 if (RunOpt.Contains(
"gstarLib",TString::kIgnoreCase)) {geant->
Do(
"call gstar");}
270 if (pTmin < 0) pTmin = mass*bgMin;
if (pTmin < 0.01) pTmin = 0.01;
271 if (pTmax < 0) pTmax = mass*bgMax;
if (pTmax > 1000.00) pTmax = 1000.00;
273 Double_t bgMin10 = TMath::Log10(bgMin);
274 Double_t bgMax10 = TMath::Log10(bgMax);
275 TString Kine(Form(
"gkine %i %i %f %f -2 2 0 %f -50 50;",NTRACK,ID,pTmin,pTmax,TMath::TwoPi()));
276 cout <<
"Set kinematics: " << Kine.Data() << endl;
277 geant->
Do(Kine.Data());
281 if (! StVMCMaker::instance())
return 0;
282 if (! StarVMCApplication::Instance())
return 0;
283 StarMCSimplePrimaryGenerator *gener = (StarMCSimplePrimaryGenerator *) StarVMCApplication::Instance()->GetPrimaryGenerator();
284 if ( gener && ! gener->IsA()->InheritsFrom(
"StarMCSimplePrimaryGenerator" ) ) {
285 delete gener; gener = 0;
287 const Char_t *names[15] = {
"muon+",
"muon-",
"electron",
"positron",
"pion+",
"pion-",
"kaon+",
"kaon-",
"proton",
"pbar",
"deuteron",
"triton",
"He3",
"alpha",
"pionMIP"};
288 Int_t Ids[15] = { 5, 6, 3, 2, 8, 9, 11, 12, 14, 15, 45, 46, 49, 47, 8};
294 Double_t Phihigh= 2*TMath::Pi();
297 Double_t bgMinL10 = -1;
298 Double_t bgMaxL10 = 6;
299 for (Int_t i = 0; i < 15; i++) {
300 if (Opt.Contains(names[i])) {
302 if (i == 14) {bgMinL10 = 0.544; bgMaxL10 = 0.653;}
306 if (! gener) gener =
new
307 StarMCSimplePrimaryGenerator( NTRACK, ID, bgMinL10, bgMaxL10,Ylow, Yhigh, Philow, Phihigh, Zlow, Zhigh,
"GBL");
309 gener->SetGenerator( NTRACK, ID, bgMinL10, bgMaxL10,Ylow, Yhigh, Philow, Phihigh, Zlow, Zhigh,
"GBL");
310 StarVMCApplication::Instance()->SetPrimaryGenerator(gener);
311 cout <<
"Set StarMCSimplePrimaryGenerator" << endl;
313 if (Last > 0) chain->EventLoop(First,Last);
316 void TpcRS(Int_t Last=100,
317 const Char_t *Run =
"y2009,TpcRS",
318 const Char_t *fileIn = 0,
319 const Char_t *opt =
"Bichsel",
const Char_t *kuip = 0,
320 const Char_t *fileOut = 0) {
325 TpcRS(1,Last,Run,fileIn,opt,kuip,fileOut);
virtual TDataSet * First() const
Return the first object in the list. Returns 0 when list is empty.
virtual TDataSet * Last() const
Return the last object in the list. Returns 0 when list is empty.
virtual void Do(const Char_t *option="dcut cave x 0.1 10 10 0.03 0.03")
Executes a KUIP command.