4 #include "StIOMaker/StIOMaker.h"
5 #include "StEventMaker/StEventMaker.h"
7 #include "StStrangeMuDstMaker/StV0MuDst.hh"
8 #include "StStrangeMuDstMaker/StXiMuDst.hh"
9 #include "StStrangeMuDstMaker/StKinkMuDst.hh"
10 #include "StStrangeMuDstMaker/StStrangeCuts.hh"
11 #include "StStrangeMuDstMaker/StStrangeEvMuDst.hh"
12 #include "StStrangeMuDstPlayer.h"
13 #include "StMessMgr.h"
14 #include "StMcEventMaker/StMcEventMaker.h"
15 #include "StAssociationMaker/StAssociationMaker.h"
22 void ParseFileName(const Char_t *output, const Char_t **file, const Char_t **dir) {
23 if ((*file = std::strrchr(output,slash))) {
25 char *_dir =
new char[strlen(output)+5];
26 strncpy(_dir,output,(strlen(output)-strlen(*file)));
34 StrangeMuDstPlayer::StrangeMuDstPlayer() {
47 v0DcaDaughtersToPrimVertex = 0.7;
48 v0DcaToPrimVertex = 0.8;
49 v0DcaDaughters = 0.75;
53 xiDcaV0Daughters = 0.7;
54 xiDcaToPrimVertex = 0.7;
55 xiDcaV0ToPrimVertex = 0.;
56 xiDcaBachelorToPrimVertex = 0.;
59 void StrangeMuDstPlayer::Make(Int_t NEvents,
StFile* input,
const Char_t* output) {
68 const Char_t *file, *dir; Char_t *outfile[3], line[80];
70 Int_t mNDstMakers = 0;
76 IOMaker =
new StIOMaker(
"IO",
"r",input,
"bfcTree");
78 IOMaker->SetBranch(
"*",0,
"0");
79 IOMaker->SetBranch(
"runcoBranch",0,
"r");
81 IOMaker->SetBranch(
"dstBranch",0,
"r");
84 IOMaker->SetBranch(
"eventBranch",0,
"r");
87 IOMaker->SetBranch(
"geantBranch",0,
"r");
100 muDstMakers[mNDstMakers] = v0MuDstMaker;
101 prefix[mNDstMakers] =
"v0_";
106 xiMuDstMaker->DoXi();
107 muDstMakers[mNDstMakers] = xiMuDstMaker;
108 prefix[mNDstMakers] =
"xi_";
113 kinkMuDstMaker->DoKink();
114 muDstMakers[mNDstMakers] = kinkMuDstMaker;
115 prefix[mNDstMakers] =
"kink_";
118 ParseFileName(output, &file, &dir);
119 for(Int_t i=0; i<mNDstMakers; i++) {
121 outfile[i] =
new char[strlen(output)+5];
122 strcpy(outfile[i],dir);
123 strcat(outfile[i],prefix[i].Data());
124 strcat(outfile[i],file);
125 muDstMakers[i]->SetWrite(outfile[i]);
127 muDstMakers[i]->DoT0JitterAbort();
129 muDstMakers[i]->DoMc();
134 if( doV0 ) muDstMakers[0]->DoV0();
135 if( doXi ) muDstMakers[0]->DoXi();
136 if( doKink ) muDstMakers[0]->DoKink();
137 muDstMakers[0]->SetWrite(output);
139 muDstMakers[0]->DoT0JitterAbort();
141 muDstMakers[0]->DoMc();
145 Int_t istatus = chain.Init();
146 if( istatus ) { chain.FatalErr(istatus,
"on init");
return; }
149 for( Int_t i=0; i<NEvents; i++ ) {
150 switch (istatus = chain.
Make()) {
152 case 2: { gMessMgr->Info(
"Last event from input.");
break; }
153 case 3: { gMessMgr->Error() <<
"Event " << i <<
" had error " <<
154 istatus <<
". Continuing."; gMessMgr->Print();
break; }
155 default: { gMessMgr->Warning() <<
"Event " << i <<
" returned status " <<
156 istatus <<
". Continuing."; gMessMgr->Print(); }
159 if( istatus == 2 )
break;
161 if( i != NEvents) chain.
Clear();
162 sprintf(line,
"*** Finished processing event %d",i);
163 gMessMgr->Info(line);
172 void StrangeMuDstPlayer::Filter(Int_t NEvents,
StFile* input,
const Char_t* output) {
179 const Char_t *file, *dir; Char_t *outfile[3], line[80];
181 Int_t mNDstMakers = 0;
197 v0MuDstMaker->DoV0();
198 newMuDstMakers[mNDstMakers] = v0MuDstMaker;
199 prefix[mNDstMakers] =
"v0_";
204 xiMuDstMaker->DoXi();
205 newMuDstMakers[mNDstMakers] = xiMuDstMaker;
206 prefix[mNDstMakers] =
"xi_";
211 kinkMuDstMaker->DoKink();
212 newMuDstMakers[mNDstMakers] = kinkMuDstMaker;
213 prefix[mNDstMakers] =
"kink_";
216 ParseFileName(output, &file, &dir);
217 for(Int_t i=0; i<mNDstMakers; i++) {
219 outfile[i] =
new char[strlen(output)+5];
220 strcpy(outfile[i],dir);
221 strcat(outfile[i],prefix[i].Data());
222 strcat(outfile[i],file);
223 newMuDstMakers[i]->SetWrite(outfile[i]);
225 newMuDstMakers[i]->DoT0JitterAbort();
227 newMuDstMakers[i]->DoMc();
232 if( doV0 ) newMuDstMakers[0]->DoV0();
233 if( doXi ) newMuDstMakers[0]->DoXi();
234 if( doKink ) newMuDstMakers[0]->DoKink();
235 newMuDstMakers[0]->SetWrite(output);
237 newMuDstMakers[0]->DoT0JitterAbort();
239 newMuDstMakers[0]->DoMc();
241 v0MuDstMaker = newMuDstMakers[0];
242 xiMuDstMaker = newMuDstMakers[0];
243 kinkMuDstMaker = newMuDstMakers[0];
247 oldMuDstMaker->SetRead(input);
249 {
for( Int_t i=0; i<mNDstMakers; i++ )
250 newMuDstMakers[i]->SubDst(oldMuDstMaker);}
255 {
for( Int_t i=0; i<mNDstMakers; i++ ) {
256 sprintf(buff,
"< +/- %f",evPrimVertexZ);
257 newMuDstMakers[i]->Cuts().Add(
"evPrimVertexZ",buff);
258 sprintf(buff,
"> %d",evPrimTracks);
259 newMuDstMakers[i]->Cuts().Add(
"evPrimTracks",buff);
263 sprintf(buff,
"> %f",v0DecayLength);
264 v0MuDstMaker->Cuts().Add(
"v0DecayLength",buff);
265 sprintf(buff,
"> %f",v0DcaDaughtersToPrimVertex);
266 v0MuDstMaker->Cuts().Add(
"dcaPosToPrimVertex || dcaNegToPrimVertex",buff);
267 sprintf(buff,
"< %f",v0DcaToPrimVertex);
268 v0MuDstMaker->Cuts().Add(
"v0DcaToPrimVertex",buff);
269 sprintf(buff,
"< %f",v0DcaDaughters);
270 v0MuDstMaker->Cuts().Add(
"v0DcaDaughters",buff);
271 sprintf(buff,
"> %f",v0NumTpcHits);
272 v0MuDstMaker->Cuts().Add(
"v0NumTpcHits",buff);
275 sprintf(buff,
"> %f",xiDecayLength);
276 xiMuDstMaker->Cuts().Add(
"xiDecayLength",buff);
277 sprintf(buff,
"< %f",xiDcaDaughters);
278 xiMuDstMaker->Cuts().Add(
"xiDcaDaughters",buff);
279 sprintf(buff,
"< %f",xiDcaV0Daughters);
280 xiMuDstMaker->Cuts().Add(
"xiDcaV0Daughters",buff);
281 sprintf(buff,
"< %f",xiDcaToPrimVertex);
282 xiMuDstMaker->Cuts().Add(
"xiDcaToPrimVertex",buff);
283 sprintf(buff,
"> %f",xiDcaV0ToPrimVertex);
284 xiMuDstMaker->Cuts().Add(
"xiDcaV0ToPrimVertex",buff);
285 sprintf(buff,
"> %f",xiDcaBachelorToPrimVertex);
286 xiMuDstMaker->Cuts().Add(
"xiDcaBachelorToPrimVertex",buff);
289 gMessMgr->Info() <<
"evPrimVertexZ < " << evPrimVertexZ << endm;
290 gMessMgr->Info() <<
"evPrimTracks > " << evPrimTracks << endm;
291 gMessMgr->Info() <<
"v0DecayLength > " << v0DecayLength << endm;
292 gMessMgr->Info() <<
"v0DcaToPrimVertex < " << v0DcaToPrimVertex << endm;
293 gMessMgr->Info() <<
"v0DcaDaughtersToPrimVertex > " <<
294 v0DcaDaughtersToPrimVertex << endm;
295 gMessMgr->Info() <<
"v0DcaDaughters < " << v0DcaDaughters << endm;
296 gMessMgr->Info() <<
"v0NumTpcHits > " << v0NumTpcHits << endm;
297 gMessMgr->Info() <<
"xiDecayLength > " << xiDecayLength << endm;
298 gMessMgr->Info() <<
"xiDcaDaughters < " << xiDcaDaughters << endm;
299 gMessMgr->Info() <<
"xiDcaV0Daughters < " << xiDcaV0Daughters << endm;
300 gMessMgr->Info() <<
"xiDcaToPrimVertex < " << xiDcaToPrimVertex << endm;
301 gMessMgr->Info() <<
"xiDcaV0ToPrimVertex > " << xiDcaV0ToPrimVertex << endm;
302 gMessMgr->Info() <<
"xiDcaBachelorToPrimVertex > " <<
303 xiDcaBachelorToPrimVertex << endm;
306 Int_t istatus = chain.Init();
307 if( istatus ) { chain.FatalErr(istatus,
"on init");
return; }
310 for( Int_t i=0; i<NEvents; i++ ) {
311 switch (istatus = chain.
Make(i)) {
313 case 2: { gMessMgr->Info(
"Last event from input.");
break; }
314 case 3: { gMessMgr->Error() <<
"Event " << i <<
" had error " <<
315 istatus <<
". Ending."; gMessMgr->Print();
break; }
316 default: { gMessMgr->Warning() <<
"Event " << i <<
" returned status " <<
317 istatus <<
". Ending."; gMessMgr->Print(); }
323 unsigned int primaryTracks = oldMuDstMaker->GetEvent()->primaryTracks();
325 if (TMath::Abs(primZ)<evPrimVertexZ && primaryTracks>evPrimTracks) {
328 for( Int_t j=0; j<oldMuDstMaker->GetNV0(); j++ ) {
329 StV0MuDst *v0j = oldMuDstMaker->GetV0(j);
337 v0MuDstMaker->SelectV0(j);
341 for( Int_t j=0; j<oldMuDstMaker->GetNXi(); j++ ) {
342 StXiMuDst *xij = oldMuDstMaker->GetXi(j);
349 xiMuDstMaker->SelectXi(j);
353 for( Int_t j=0; j<oldMuDstMaker->GetNKink(); j++ ) {
354 kinkMuDstMaker->SelectKink(j);
357 {
for( Int_t j=0; j<mNDstMakers; j++ )
358 newMuDstMakers[j]->AbortEvent();}
361 if( i != NEvents) chain.
Clear();
362 sprintf(line,
"*** Finished processing event %d",i);
363 gMessMgr->Info(line);
372 void StrangeMuDstPlayer::Play(Int_t NEvents,
StFile* input,
const Char_t* output) {
384 const Char_t *file, *dir; Char_t *outfile[3], line[80];
386 Int_t mNDstMakers = 0;
392 IOMaker =
new StIOMaker(
"IO",
"r",input,
"bfcTree");
394 IOMaker->SetBranch(
"*",0,
"0");
395 IOMaker->SetBranch(
"runcoBranch",0,
"r");
397 IOMaker->SetBranch(
"dstBranch",0,
"r");
400 IOMaker->SetBranch(
"eventBranch",0,
"r");
403 IOMaker->SetBranch(
"geantBranch",0,
"r");
421 v0MuDstMaker->DoV0();
422 newMuDstMakers[mNDstMakers] = v0MuDstMaker;
423 prefix[mNDstMakers] =
"v0_";
428 xiMuDstMaker->DoXi();
429 newMuDstMakers[mNDstMakers] = xiMuDstMaker;
430 prefix[mNDstMakers] =
"xi_";
435 kinkMuDstMaker->DoKink();
436 newMuDstMakers[mNDstMakers] = kinkMuDstMaker;
437 prefix[mNDstMakers] =
"kink_";
440 ParseFileName(output, &file, &dir);
441 for(Int_t i=0; i<mNDstMakers; i++) {
443 outfile[i] =
new char[strlen(output)+5];
444 strcpy(outfile[i],dir);
445 strcat(outfile[i],prefix[i].Data());
446 strcat(outfile[i],file);
447 newMuDstMakers[i]->SetWrite(outfile[i]);
449 newMuDstMakers[i]->DoT0JitterAbort();
451 newMuDstMakers[i]->DoMc();
456 if( doV0 ) newMuDstMakers[0]->DoV0();
457 if( doXi ) newMuDstMakers[0]->DoXi();
458 if( doKink ) newMuDstMakers[0]->DoKink();
459 newMuDstMakers[0]->SetWrite(output);
461 newMuDstMakers[0]->DoT0JitterAbort();
463 newMuDstMakers[0]->DoMc();
465 v0MuDstMaker = newMuDstMakers[0];
466 xiMuDstMaker = newMuDstMakers[0];
467 kinkMuDstMaker = newMuDstMakers[0];
471 oldMuDstMaker->SetNoKeep();
473 oldMuDstMaker->DoT0JitterAbort();
475 {
for( Int_t i=0; i<mNDstMakers; i++ )
476 newMuDstMakers[i]->SubDst(oldMuDstMaker);}
481 {
for( Int_t i=0; i<mNDstMakers; i++ ) {
482 sprintf(buff,
"< +/- %f",evPrimVertexZ);
483 newMuDstMakers[i]->Cuts().Add(
"evPrimVertexZ",buff);
484 sprintf(buff,
"> %d",evPrimTracks);
485 newMuDstMakers[i]->Cuts().Add(
"evPrimTracks",buff);
489 sprintf(buff,
"> %f",v0DecayLength);
490 v0MuDstMaker->Cuts().Add(
"v0DecayLength",buff);
491 sprintf(buff,
"> %f",v0DcaDaughtersToPrimVertex);
492 v0MuDstMaker->Cuts().Add(
"dcaPosToPrimVertex || dcaNegToPrimVertex",buff);
493 sprintf(buff,
"< %f",v0DcaToPrimVertex);
494 v0MuDstMaker->Cuts().Add(
"v0DcaToPrimVertex",buff);
495 sprintf(buff,
"< %f",v0DcaDaughters);
496 v0MuDstMaker->Cuts().Add(
"v0DcaDaughters",buff);
497 sprintf(buff,
"> %f",v0NumTpcHits);
498 v0MuDstMaker->Cuts().Add(
"v0NumTpcHits",buff);
501 sprintf(buff,
"> %f",xiDecayLength);
502 xiMuDstMaker->Cuts().Add(
"xiDecayLength",buff);
503 sprintf(buff,
"< %f",xiDcaDaughters);
504 xiMuDstMaker->Cuts().Add(
"xiDcaDaughters",buff);
505 sprintf(buff,
"< %f",xiDcaV0Daughters);
506 xiMuDstMaker->Cuts().Add(
"xiDcaV0Daughters",buff);
507 sprintf(buff,
"< %f",xiDcaToPrimVertex);
508 xiMuDstMaker->Cuts().Add(
"xiDcaToPrimVertex",buff);
509 sprintf(buff,
"> %f",xiDcaV0ToPrimVertex);
510 xiMuDstMaker->Cuts().Add(
"xiDcaV0ToPrimVertex",buff);
511 sprintf(buff,
"> %f",xiDcaBachelorToPrimVertex);
512 xiMuDstMaker->Cuts().Add(
"xiDcaBachelorToPrimVertex",buff);
515 gMessMgr->Info() <<
"evPrimVertexZ < " << evPrimVertexZ << endm;
516 gMessMgr->Info() <<
"evPrimTracks > " << evPrimTracks << endm;
517 gMessMgr->Info() <<
"v0DecayLength > " << v0DecayLength << endm;
518 gMessMgr->Info() <<
"v0DcaToPrimVertex < " << v0DcaToPrimVertex << endm;
519 gMessMgr->Info() <<
"v0DcaDaughtersToPrimVertex > " <<
520 v0DcaDaughtersToPrimVertex << endm;
521 gMessMgr->Info() <<
"v0DcaDaughters < " << v0DcaDaughters << endm;
522 gMessMgr->Info() <<
"v0NumTpcHits > " << v0NumTpcHits << endm;
523 gMessMgr->Info() <<
"xiDecayLength > " << xiDecayLength << endm;
524 gMessMgr->Info() <<
"xiDcaDaughters < " << xiDcaDaughters << endm;
525 gMessMgr->Info() <<
"xiDcaV0Daughters < " << xiDcaV0Daughters << endm;
526 gMessMgr->Info() <<
"xiDcaToPrimVertex < " << xiDcaToPrimVertex << endm;
527 gMessMgr->Info() <<
"xiDcaV0ToPrimVertex > " << xiDcaV0ToPrimVertex << endm;
528 gMessMgr->Info() <<
"xiDcaBachelorToPrimVertex > " <<
529 xiDcaBachelorToPrimVertex << endm;
532 Int_t istatus = chain.Init();
533 if( istatus ) { chain.FatalErr(istatus,
"on init");
return; }
536 for( Int_t i=0; i<NEvents; i++ ) {
537 switch (istatus = chain.
Make()) {
539 case 2: { gMessMgr->Info(
"Last event from input.");
break; }
540 case 3: { gMessMgr->Error() <<
"Event " << i <<
" had error " <<
541 istatus <<
". Continuing."; gMessMgr->Print();
break; }
542 default: { gMessMgr->Warning() <<
"Event " << i <<
" returned status " <<
543 istatus <<
". Continuing."; gMessMgr->Print(); }
546 if( istatus == 2 )
break;
549 unsigned int primaryTracks = oldMuDstMaker->GetEvent()->primaryTracks();
551 if (TMath::Abs(primZ)<evPrimVertexZ && primaryTracks>evPrimTracks) {
554 for( Int_t j=0; j<oldMuDstMaker->GetNV0(); j++ ) {
555 StV0MuDst *v0j = oldMuDstMaker->GetV0(j);
563 v0MuDstMaker->SelectV0(j);
567 for( Int_t j=0; j<oldMuDstMaker->GetNXi(); j++ ) {
568 StXiMuDst *xij = oldMuDstMaker->GetXi(j);
575 xiMuDstMaker->SelectXi(j);
579 for( Int_t j=0; j<oldMuDstMaker->GetNKink(); j++ ) {
580 kinkMuDstMaker->SelectKink(j);
583 {
for( Int_t j=0; j<mNDstMakers; j++ )
584 newMuDstMakers[j]->AbortEvent();}
587 if( i != NEvents) chain.
Clear();
588 sprintf(line,
"*** Finished processing event %d",i);
589 gMessMgr->Info(line);
598 void StrangeMuDstPlayer::Copy(Int_t NEvents,
StFile* input,
const Char_t* output) {
605 const Char_t *file, *dir; Char_t *outfile[3], line[80];
607 Int_t mNDstMakers = 0;
623 v0MuDstMaker->DoV0();
624 newMuDstMakers[mNDstMakers] = v0MuDstMaker;
625 prefix[mNDstMakers] =
"v0_";
630 xiMuDstMaker->DoXi();
631 newMuDstMakers[mNDstMakers] = xiMuDstMaker;
632 prefix[mNDstMakers] =
"xi_";
637 kinkMuDstMaker->DoKink();
638 newMuDstMakers[mNDstMakers] = kinkMuDstMaker;
639 prefix[mNDstMakers] =
"kink_";
642 ParseFileName(output, &file, &dir);
643 for(Int_t i=0; i<mNDstMakers; i++) {
645 outfile[i] =
new char[strlen(output)+5];
646 strcpy(outfile[i],dir);
647 strcat(outfile[i],prefix[i].Data());
648 strcat(outfile[i],file);
649 newMuDstMakers[i]->SetWrite(outfile[i]);
651 newMuDstMakers[i]->DoT0JitterAbort();
653 newMuDstMakers[i]->DoMc();
658 if( doV0 ) newMuDstMakers[0]->DoV0();
659 if( doXi ) newMuDstMakers[0]->DoXi();
660 if( doKink ) newMuDstMakers[0]->DoKink();
661 newMuDstMakers[0]->SetWrite(output);
663 newMuDstMakers[0]->DoT0JitterAbort();
665 newMuDstMakers[0]->DoMc();
667 v0MuDstMaker = newMuDstMakers[0];
668 xiMuDstMaker = newMuDstMakers[0];
669 kinkMuDstMaker = newMuDstMakers[0];
673 oldMuDstMaker->SetRead(input);
675 {
for( Int_t i=0; i<mNDstMakers; i++ )
676 newMuDstMakers[i]->SubDst(oldMuDstMaker);}
679 Int_t istatus = chain.Init();
680 if( istatus ) { chain.FatalErr(istatus,
"on init");
return; }
683 for( Int_t i=0; i<NEvents; i++ ) {
684 switch (istatus = chain.
Make(i)) {
686 case 2: { gMessMgr->Info(
"Last event from input.");
break; }
687 case 3: { gMessMgr->Error() <<
"Event " << i <<
" had error " <<
688 istatus <<
". Ending."; gMessMgr->Print();
break; }
689 default: { gMessMgr->Warning() <<
"Event " << i <<
" returned status " <<
690 istatus <<
". Ending."; gMessMgr->Print(); }
697 for( Int_t j=0; j<oldMuDstMaker->GetNV0(); j++ )
698 v0MuDstMaker->SelectV0(j);
701 for( Int_t j=0; j<oldMuDstMaker->GetNXi(); j++ )
702 xiMuDstMaker->SelectXi(j);
705 for( Int_t j=0; j<oldMuDstMaker->GetNKink(); j++ )
706 kinkMuDstMaker->SelectKink(j);
708 if( i != NEvents) chain.
Clear();
709 sprintf(line,
"*** Finished processing event %d",i);
710 gMessMgr->Info(line);
Float_t dcaV0ToPrimVertex() const
DCA of v0 to primary vertex.
Float_t dcaPosToPrimVertex() const
DCA of pos v0 daughter to pri vertex.
virtual void Clear(Option_t *option="")
User defined functions.
virtual Float_t decayLengthV0() const
3-d decay distance
StTrackTopologyMap & topologyMapPos()
Pos. daughter track topology map.
Float_t decayLengthXi() const
3-d decay distance of Xi
Float_t dcaBachelorToPrimVertex() const
DCA of bachelor to primary vertex.
Float_t dcaXiDaughters() const
DCA of xi daughters at decay vertex.
Filling of all StMcEvent classes from g2t tables Transform all the data in the g2t tables into the co...
Float_t dcaNegToPrimVertex() const
DCA of neg v0 daughter to pri vertex.
StTrackTopologyMap & topologyMapNeg()
Neg. daughter track topology map.
Float_t dcaXiToPrimVertex() const
DCA of xi to primary vertex.
Float_t dcaV0Daughters() const
DCA of v0 daughters at decay vertex.
Float_t primaryVertexZ() const
Primary vtx position coordinates.