FEDRA emulsion software from the OPERA Collaboration
EdbFeedback Class Reference

#include <TOracleServerE2WFB.h>

Inheritance diagram for EdbFeedback:
Collaboration diagram for EdbFeedback:

Public Member Functions

const char * Darkness (int drk)
 
const char * DecayFlag (int flag)
 
 EdbFeedback ()
 array of tracks More...
 
int InitDB (const char *conn, const char *user, const char *pwd)
 
int LoadFBintoDB ()
 
const char * Ofb (int ofb)
 
const char * PartType (int parttype)
 
void Print ()
 
void Print (fbsegment *s)
 
void Print (fbtrack *t)
 
void Print (fbvertex *v)
 
void PrintFB ()
 
int ReadFBFile (const char *file)
 
fbsegmentReadSegment (FILE *f)
 
fbtrackReadTrack (const char *str)
 
fbvertexReadVertex (const char *str)
 
const char * SegmentRecMode (int mode)
 
const char * SegmentType (int type)
 
 ~EdbFeedback ()
 

Public Attributes

ULong64_t eBrick
 
TOracleServerE2WFBeDB
 
Int_t eERROR
 
ULong64_t eEvent
 
ULong64_t eEventBrick
 
ULong64_t eIdMachine
 
ULong64_t eIdProgramsettings
 
ULong64_t eIdRequester
 
int eNtr
 
int eNtrLim
 
int eNvtx
 
int eNvtxLim
 
ULong64_t eProcOp
 
ULong64_t eRecID
 
fbtrack ** eT
 array of vertices More...
 
fbvertex ** eV
 

Constructor & Destructor Documentation

◆ EdbFeedback()

EdbFeedback::EdbFeedback ( )

array of tracks

423{
424 eDB=0;
425 eEvent=0;
426 eEventBrick=0;
427 eProcOp=0;
428 eNvtx=0;
429 eNvtxLim=1000;
430 eNtr=0;
431 eNtrLim=5000;
432 eV=0;
433 eIdMachine=0;
435 eIdRequester=0;
436 eERROR=0;
437}
ULong64_t eEvent
Definition: TOracleServerE2WFB.h:190
ULong64_t eProcOp
Definition: TOracleServerE2WFB.h:191
ULong64_t eEventBrick
Definition: TOracleServerE2WFB.h:189
ULong64_t eIdMachine
Definition: TOracleServerE2WFB.h:185
int eNtrLim
Definition: TOracleServerE2WFB.h:197
ULong64_t eIdProgramsettings
Definition: TOracleServerE2WFB.h:186
int eNvtx
Definition: TOracleServerE2WFB.h:196
ULong64_t eIdRequester
Definition: TOracleServerE2WFB.h:187
TOracleServerE2WFB * eDB
Definition: TOracleServerE2WFB.h:184
int eNvtxLim
Definition: TOracleServerE2WFB.h:195
Int_t eERROR
Definition: TOracleServerE2WFB.h:194
fbvertex ** eV
Definition: TOracleServerE2WFB.h:199
int eNtr
Definition: TOracleServerE2WFB.h:198

◆ ~EdbFeedback()

EdbFeedback::~EdbFeedback ( )
inline
204{}

Member Function Documentation

◆ Darkness()

const char * EdbFeedback::Darkness ( int  drk)
594{
595 if (drk==0) return "'MIP'";
596 if (drk==1) return "'BLACK'";
597 if (drk==2) return "'GRAY'";
598 return "null";
599}

◆ DecayFlag()

const char * EdbFeedback::DecayFlag ( int  flag)
563{
564 if (flag==1) return "'PRIMARY'";
565 if (flag==2) return "'E+E-'";
566 if (flag==3) return "'LOWP'";
567 if (flag==4) return "'SF TODO'";
568 if (flag==5) return "'SF DONE'";
569 return "null";
570}

◆ InitDB()

int EdbFeedback::InitDB ( const char *  conn,
const char *  user,
const char *  pwd 
)
458{
459 eDB = new TOracleServerE2WFB( conn, user, pwd );
460 if(!eDB) return 0;
461 return 1;
462}
Definition: TOracleServerE2WFB.h:14

◆ LoadFBintoDB()

int EdbFeedback::LoadFBintoDB ( )
466{
467 if(eNtr<1) return 0;
468 if(!eDB) return 0;
469
471 eIdMachine, // id_machine
472 eIdProgramsettings, // id_programsettings
473 eIdRequester, // id_requester
474 eEventBrick, // id_eventbrick
475 0 , // id_parent_operation
476 eDB->Timestamp(), // starttime
477 "Feedback"); // notes
478
480
481 Log(2,"EdbFeedback::LoadFBintoDB","%d tracks to be added to RecID %d",eNtr, eRecID);
482
483 for( int iv=0; iv<eNvtxLim; iv++ ) {
484 fbvertex *v = eV[iv];
485 if(v) {
486 const char *vprim = v->isprim? "'Y'" : "'N'";
487 const char *vcharm = v->ischarm? "'Y'" : "'N'";
488 const char *vtau = v->istau? "'Y'" : "'N'";
489 const char *vout = v->ofb? "'Y'" : "'N'";
490 eDB->AddFeedbackVertex(eEventBrick, eRecID, v->idvtx, v->x, v->y, v->z, vprim,vcharm,vtau,vout);
491 }
492 }
493
494 for(int it=0; it<eNtr; it++ ) {
495 fbtrack *t = eT[it];
496 if(!t) {
497 Log(1,"EdbFeedback::LoadFBintoDB","ERROR: track %d is missing!", it);
498 eERROR=1;
499 return 0;
500 }
501
502 const char *tman = t->isman? "'Y'" : "'N'";
503 const char *tparticle = PartType(t->type);
504 const char *tscanback = t->scanback? "'Y'" : "'N'";
505 const char *tdarkness = Darkness(t->darkness);
506 const char *tofb = Ofb(t->ofb);
507 const char *tdecaysearch = DecayFlag(t->flag);
508
509 eDB->AddFeedbackTrack( eEventBrick, eRecID,t->id_track, t->id_upvtx, t->id_downvtx,
510 t->x, t->y, t->z, t->sx, t->sy,
511 tman, tparticle, tscanback, tdarkness,
512 t->upip, t->downip, t->p, t->pmin, t->pmax,
513 tofb,
514 t->lastplate,
515 t->rslopet , t->rslopel, t->rmsslopet , t->rmsslopel,
516 t->kinkplatedown , t->kinkplateup,
517 tdecaysearch,
518 eEvent
519 );
520
521 for(int is=0; is<t->nseg; is++ ) {
522 fbsegment *s = t->segments[is];
523 if(!s) {
524 Log(1,"EdbFeedback::LoadFBintoDB","ERROR: segment %d of track %d is missing!", is, it);
525 eERROR=1;
526 return 0;
527 }
528 if(s->id_plate!=44)
530 s->id_plate, t->id_track,
531 SegmentType(s->type),
532 s->x, s->y, s->z, s->sx, s->sy,
533 s->grains,
534 SegmentRecMode(s->irec)
535 );
536 }
537 }
538
540
541 return 1;
542}
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
const char * PartType(int parttype)
Definition: TOracleServerE2WFB.cxx:582
const char * Ofb(int ofb)
Definition: TOracleServerE2WFB.cxx:573
fbtrack ** eT
array of vertices
Definition: TOracleServerE2WFB.h:200
const char * SegmentType(int type)
Definition: TOracleServerE2WFB.cxx:553
const char * DecayFlag(int flag)
Definition: TOracleServerE2WFB.cxx:562
ULong64_t eRecID
Definition: TOracleServerE2WFB.h:192
const char * SegmentRecMode(int mode)
Definition: TOracleServerE2WFB.cxx:545
const char * Darkness(int drk)
Definition: TOracleServerE2WFB.cxx:593
Int_t AddFeedbackTrack(ULong64_t id_eventbrick, ULong64_t id_reconstruction, Int_t id_track, Int_t id_upvtx, Int_t id_downvtx, Float_t x, Float_t y, Float_t z, Float_t sx, Float_t sy, const char *manual, const char *particle, const char *scanback, const char *darkness, Float_t upip, Float_t downip, Float_t p, Float_t pmin, Float_t pmax, const char *outofbrick, Int_t lastplate, Float_t rslopet, Float_t rslopel, Float_t rmsslopet, Float_t rmsslopel, Int_t kinkplatedown, Int_t kinkplateup, const char *decaysearch, ULong64_t event)
Definition: TOracleServerE2WFB.cxx:302
ULong64_t AddFeedbackReconstruction(ULong64_t id_eventbrick, ULong64_t id_processoperation)
Definition: TOracleServerE2WFB.cxx:245
Int_t AddFeedbackVertex(ULong64_t id_eventbrick, ULong64_t id_reconstruction, Int_t id_vertex, Float_t posx, Float_t posy, Float_t posz, const char *isprimary, const char *ischarm, const char *istau, const char *outofbrick)
Definition: TOracleServerE2WFB.cxx:275
Int_t AddFeedbackSegment(ULong64_t id_eventbrick, ULong64_t id_reconstruction, Int_t id_plate, Int_t id_track, const char *tracktype, Float_t posx, Float_t posy, Float_t posz, Float_t slopex, Float_t slopey, Int_t grains, const char *trackmode)
Definition: TOracleServerE2WFB.cxx:364
const char * Timestamp()
Definition: TOracleServerE2WFB.cxx:27
Int_t CloseFeedbackDataset(ULong64_t id_operation, const char *endtime)
Definition: TOracleServerE2WFB.cxx:398
ULong64_t AddProcessOperationBrick(ULong64_t id_machine, ULong64_t id_programsettings, ULong64_t id_requester, ULong64_t id_eventbrick, ULong64_t id_parent_operation, const char *starttime, const char *notes)
Definition: TOracleServerE2WFB.cxx:168
TTree * t
Definition: check_shower.C:4
s
Definition: check_shower.C:55
Definition: TOracleServerE2WFB.h:122
Definition: TOracleServerE2WFB.h:134
Definition: TOracleServerE2WFB.h:165
Float_t x
Definition: TOracleServerE2WFB.h:168
Int_t isprim
Definition: TOracleServerE2WFB.h:171
Int_t ofb
Definition: TOracleServerE2WFB.h:176
Float_t z
Definition: TOracleServerE2WFB.h:170
Int_t ischarm
Definition: TOracleServerE2WFB.h:172
Int_t idvtx
Definition: TOracleServerE2WFB.h:167
Int_t istau
Definition: TOracleServerE2WFB.h:173
Float_t y
Definition: TOracleServerE2WFB.h:169

◆ Ofb()

const char * EdbFeedback::Ofb ( int  ofb)
574{
575 if (ofb==0) return "' '";
576 if (ofb==1) return "'PASSING_THROUGH'";
577 if (ofb==2) return "'EDGE_OUT'";
578 return "null";
579}

◆ PartType()

const char * EdbFeedback::PartType ( int  parttype)
583{
584 if (partype==1) return "'MUON'";
585 if (partype==2) return "'CHARM'";
586 if (partype==3) return "'ELECTRON'";
587 if (partype==4) return "'E-PAIR'";
588 if (partype==5) return "'TAU'";
589 return "null";
590}

◆ Print() [1/4]

void EdbFeedback::Print ( )
441{
442 printf("\n--------------------------------------------------------\n");
443 printf("EdbFeedback: \n\
444 \t eEventBrick=%lld \n\
445 \t eEvent=%lld \n\
446 \t eProcOp=%lld \n\
447 \t eNvtx=%d \n\
448 \t eIdMachine=%lld \n\
449 \t eIdProgramsettings=%lld \n\
450 \t eIdRequester=%lld \n",
452 if(eDB) eDB->Print();
453 printf("--------------------------------------------------------\n\n");
454}
void Print()
Definition: TOracleServerE2WFB.cxx:20

◆ Print() [2/4]

void EdbFeedback::Print ( fbsegment s)
764{
765 if(s) printf("%d %f %f %f %f %f %d %d %d\n",
766 s->id_plate, s->x , s->y , s->z , s->sx , s->sy,
767 s->type , s->irec , s->grains
768 );
769}

◆ Print() [3/4]

void EdbFeedback::Print ( fbtrack t)
750{
751 if(t) printf("%d %d %d %f %f %f %f %f %f %f %f %f %f %d %d %d %d %d %d %d %f %f %f %f %d %d %d\n",
752 t->id_track, t->id_upvtx, t->id_downvtx,
753 t->x, t->y, t->z, t->sx, t->sy,
754 t->upip, t->downip,
755 t->p, t->pmin, t->pmax,
756 t->isman, t->type , t->scanback , t->darkness , t->ofb , t->lastplate,
757 t->nseg , t->rmsslopet , t->rmsslopel , t->rslopet , t->rslopel ,
758 t->kinkplatedown , t->kinkplateup , t->flag
759 );
760}

◆ Print() [4/4]

void EdbFeedback::Print ( fbvertex v)
741{
742 if(v) printf("%d %f %f %f %d %d %d %d %d %d\n",
743 v->idvtx, v->x, v->y, v->z,
744 v->isprim, v->ischarm, v->istau, v->nup, v->ndown, v->ofb
745 );
746}
Int_t ndown
Definition: TOracleServerE2WFB.h:174
Int_t nup
Definition: TOracleServerE2WFB.h:175

◆ PrintFB()

void EdbFeedback::PrintFB ( )
721{
722 for( int iv=0; iv<eNvtxLim; iv++ ) {
723 fbvertex *v = eV[iv];
724 if(v) Print(v);
725 }
726
727 for(int it=0; it<eNtrLim; it++ ) {
728 fbtrack *t = eT[it];
729 if(t) {
730 Print(t);
731 for(int is=0; is<t->nseg; is++ ) {
732 fbsegment *s = t->segments[is];
733 if(s) Print(s);
734 }
735 }
736 }
737}
void Print()
Definition: TOracleServerE2WFB.cxx:440

◆ ReadFBFile()

int EdbFeedback::ReadFBFile ( const char *  file)
603{
604 FILE *f = fopen(file,"r"); if(!f) {
605 Log(1,"EdbFeedback::ReadFBFile","ERROR! open file %s", file);
606 eERROR=1;
607 return 0;
608 }
609 Log(2,"EdbFeedback::ReadFBFile","%s", file);
610
611 eNvtx=0;
612 eV = new fbvertex*[eNvtxLim]; for(int i=0; i<eNvtxLim; i++) eV[i]=0;
613
614 eNtr=0;
615 eT = new fbtrack*[eNtrLim]; for(int i=0; i<eNtrLim; i++) eT[i]=0;
616
617 char str[1024];
618 while( fgets( str, sizeof(str), f) )
619 {
620 if( fbvertex *v = ReadVertex(str) )
621 {
622 if( v->idvtx<0 && v->idvtx>=eNvtxLim )
623 {
624 Log(1,"EdbFeedback::ReadFBFile","ERROR: vertex id %d is out of range (0-%d)!",v->idvtx,eNvtxLim);
625 eERROR=1;
626 break;
627 }
628 if( eV[v->idvtx]!=0 )
629 {
630 Log(1,"EdbFeedback::ReadFBFile","ERROR: vertex id (%d) is duplicated!",v->idvtx);
631 eERROR=1;
632 break;
633 }
634
635 eV[v->idvtx] = v;
636 eNvtx++;
637 }
638 else if( fbtrack *t = ReadTrack(str) )
639 {
640 if( eNtr>=eNtrLim )
641 {
642 Log(1,"EdbFeedback::ReadFBFile","ERROR: tracks out of limit %d!",eNtrLim);
643 eERROR=1;
644 break;
645 }
646
647 if( t->nseg > 0) {
648 t->segments = new fbsegment*[t->nseg];
649 for(int iseg=0; iseg < t->nseg; iseg++) {
650 t->segments[iseg] = ReadSegment(f);
651 if( !(t->segments[iseg]) ) Log(1,"EdbFeedback::ReadFBFile","ERROR: read segment (%d) of track %d!",iseg,t->id_track);
652 }
653 }
654 eT[eNtr++]=t;
655 }
656 else
657 {
658 Log(1,"EdbFeedback::ReadFBFile","ERROR! bad line: %s", str);
659 eERROR=1;
660 }
661 }
662 Log(2,"EdbFeedback::ReadFBFile","%d vertices and %d tracks read from %s", eNvtx,eNtr,file );
663 return eNvtx;
664}
FILE * f
Definition: RecDispMC.C:150
fbtrack * ReadTrack(const char *str)
Definition: TOracleServerE2WFB.cxx:679
fbsegment * ReadSegment(FILE *f)
Definition: TOracleServerE2WFB.cxx:701
fbvertex * ReadVertex(const char *str)
Definition: TOracleServerE2WFB.cxx:667
TFile * file
Definition: write_pvr.C:3

◆ ReadSegment()

fbsegment * EdbFeedback::ReadSegment ( FILE *  f)
702{
703 char str[512];
704 fgets( str, sizeof(str), f);
705 fbsegment *s = new fbsegment();
706 if( 9 != sscanf(str,"%d %f %f %f %f %f %d %d %d",
707 &s->id_plate, &s->x , &s->y , &s->z , &s->sx , &s->sy ,
708 &s->type , &s->irec , &s->grains
709 ))
710 {
711 Log(1,"EdbFeedback::ReadSegment","ERROR! bad seg line: %s", str);
712 eERROR=1;
713 delete s;
714 return 0;
715 }
716 return s;
717}

◆ ReadTrack()

fbtrack * EdbFeedback::ReadTrack ( const char *  str)
680{
681 fbtrack *t = new fbtrack();
682 if( 27 != sscanf(str,"%d %d %d %f %f %f %f %f %f %f %f %f %f %d %d %d %d %d %d %d %f %f %f %f %d %d %d",
683 &t->id_track, &t->id_upvtx, &t->id_downvtx,
684 &t->x, &t->y, &t->z, &t->sx, &t->sy,
685 &t->upip, &t->downip,
686 &t->p, &t->pmin, &t->pmax,
687 &t->isman, &t->type , &t->scanback , &t->darkness , &t->ofb , &t->lastplate,
688 &t->nseg , &t->rmsslopet , &t->rmsslopel , &t->rslopet , &t->rslopel ,
689 &t->kinkplatedown , &t->kinkplateup , &t->flag
690 ))
691 {
692 Log(1,"EdbFeedback::ReadTrack","ERROR! bad trk line: %s", str);
693 eERROR=1;
694 SafeDelete(t);
695 return 0;
696 }
697 return t;
698}

◆ ReadVertex()

fbvertex * EdbFeedback::ReadVertex ( const char *  str)
668{
669 fbvertex *v = new fbvertex();
670 int npar=sscanf(str,"%d %f %f %f %d %d %d %d %d %d",
671 &v->idvtx, &v->x, &v->y, &v->z,
672 &v->isprim, &v->ischarm, &v->istau, &v->nup, &v->ndown, &v->ofb
673 );
674 if(10 != npar) SafeDelete(v);
675 return v;
676}

◆ SegmentRecMode()

const char * EdbFeedback::SegmentRecMode ( int  mode)
546{
547 if (mode==0) return "'A'";
548 if (mode==1) return "'S'";
549 if (mode==2) return "'M'";
550 return "null";
551}

◆ SegmentType()

const char * EdbFeedback::SegmentType ( int  type)
554{
555 if (type==0) return "'B'";
556 if (type==1) return "'U'";
557 if (type==2) return "'D'";
558 return "null";
559}
Int_t type
Definition: testBGReduction_By_ANN.C:15

Member Data Documentation

◆ eBrick

ULong64_t EdbFeedback::eBrick

◆ eDB

TOracleServerE2WFB* EdbFeedback::eDB

◆ eERROR

Int_t EdbFeedback::eERROR

◆ eEvent

ULong64_t EdbFeedback::eEvent

◆ eEventBrick

ULong64_t EdbFeedback::eEventBrick

◆ eIdMachine

ULong64_t EdbFeedback::eIdMachine

◆ eIdProgramsettings

ULong64_t EdbFeedback::eIdProgramsettings

◆ eIdRequester

ULong64_t EdbFeedback::eIdRequester

◆ eNtr

int EdbFeedback::eNtr

◆ eNtrLim

int EdbFeedback::eNtrLim

◆ eNvtx

int EdbFeedback::eNvtx

◆ eNvtxLim

int EdbFeedback::eNvtxLim

◆ eProcOp

ULong64_t EdbFeedback::eProcOp

◆ eRecID

ULong64_t EdbFeedback::eRecID

◆ eT

fbtrack** EdbFeedback::eT

array of vertices

◆ eV

fbvertex** EdbFeedback::eV

The documentation for this class was generated from the following files: