////////////////////////////////////////////////////////////////////////////// // fill SHOWER branches of GEANT ROOT tree // // last modified on 05/12/2008 by I. Koenig /////////////////////////////////////////////////////////////////////////////// #include "fillshow.h" #include "cfortran.h" #include "hgeantshower.h" #include "hgeantmaxtrk.h" #include "hades.h" #include "hlocation.h" #include "hcategory.h" #include "hrecevent.h" #include "hpartialevent.h" #include "hgeantkine.h" struct SHOW_DEF { // structure mapped to SHOWTUPS Fortran COMMON block Int_t ntrk; Int_t showtrk[MAXTRKSHOW]; Int_t showdet[MAXTRKSHOW]; Float_t showe[MAXTRKSHOW]; Float_t showx[MAXTRKSHOW]; Float_t showy[MAXTRKSHOW]; Float_t showtheta[MAXTRKSHOW]; Float_t showphi[MAXTRKSHOW]; Float_t showbeta[MAXTRKSHOW]; }; #define SHOWTUPLE COMMON_BLOCK(SHOWTUPLE,showtups) COMMON_BLOCK_DEF(SHOW_DEF,SHOWTUPLE); void fillshow(int* sector) { // printf("\n Inside fillshow\n"); HLocation loc; HRecEvent* pHGeantEvent = (HRecEvent*)(gHades->getCurrentEvent()); // get pointer to event HPartialEvent* pSimul = pHGeantEvent->getPartialEvent(catSimul); HCategory* pShowerCat = pSimul->getCategory(catShowerGeantRaw); // get cat if(*sector == 1) pShowerCat->Clear(); // clear category if 1st sector HCategory* pKin = pSimul->getCategory(catGeantKine); // get KINE cat Int_t index; for(int trk=0; trkgetSlot(loc,&index); // get slot and its index if(pShower==NULL) { printf("\n*** FILLSHOW: HGeantShower location not found ! ***\n"); printf("sec=%d mod=%d trk=%d\n",(*sector-1),module,trk); return; } // Int_t index = pShowerCat->getIndex(loc); pShower = new(pShower) HGeantShower; // SHOWER track data Int_t track = SHOWTUPLE.showtrk[trk]; pShower->setTrack(track); pShower->setHit(SHOWTUPLE.showe[trk],SHOWTUPLE.showx[trk], SHOWTUPLE.showy[trk], SHOWTUPLE.showbeta[trk]); pShower->setIncidence(SHOWTUPLE.showtheta[trk],SHOWTUPLE.showphi[trk]); pShower->setAddress((Char_t)(*sector-1), (Char_t)module); if(pKin != NULL && track > 0) { // add hit to linked list of track ((HGeantKine*)pKin->getObject(track-1))->setShowerHitIndex(index); pShower->sortVariable = SHOWTUPLE.showe[trk]; } } /* if(pKin != NULL && *sector == 6) { // loop over all tracks ... Int_t nTracks = pKin->getEntries(); for(Int_t i=0;igetObject(i))->sortShowerHits(); //... sort hits } } */ } // wrapping of the c++ routine as Fortran-subroutine using cfortran.h // of Cern-library FCALLSCSUB1(fillshow,FILLSHOW,fillshow,PINT)