{ //*************************************************************************** //* This macro shows the user how to read the event.dgen file. In keeping * //* with the existing BLAST conventions, all relevant quantities in the * //* event.dgen file are in terms of the following units: * //* * //* [GeV], [cm], [ns], [deg], [bins] * //* * //*************************************************************************** //*************************************************************************** //* File header variables * //*************************************************************************** const Int_t MAXNKINE=5; //max num of kine params to define //evt const Int_t MAXNPART=5; //max num of particles in evt //definition Char_t rxnName[256]; //name of reaction Int_t nKine; //actual num of kine params to //define evt Char_t kineName[MAXNKINE][256]; //name of each kinematic parameter Int_t nPart; //actual num of particles in evt Char_t partName[MAXNPART][256]; //name of each particle in evt Float_t beamEnergy; //beam energy //*************************************************************************** //* Event-specific variables * //*************************************************************************** Int_t nEvent; //evt number in file Float_t kineVal[MAXNKINE]; //value of kine params for evt Int_t nHitsWCEvt; //num total WC hits in evt Int_t nHitsSCEvt; //num total SC hits in evt Int_t nHitsCCEvt; //num total CC hits in evt Int_t nHitsNCEvt; //num total NC hits in evt Int_t nHitsLDEvt; //num total LD hits in evt Float_t vertex[MAXNPART][3]; //x/y/z vertex for each particle //in evt Float_t mom[MAXNPART][3]; //px/py/pz momentum for each part //in evt //*************************************************************************** //* WC-specific and event-specific variables * //*************************************************************************** const Int_t NSECT=2; //num sectors const Int_t NCHAM=3; //num chambers per sector const Int_t NSLYR=2; //num superlayers per (sector, //chamber) pair const Int_t MAXNWCHIT=50; //max num of WC hits per particle //in evt Int_t nHitsWCTotal[MAXNPART]; //total WC hits per particle in evt Int_t nHitsWCPerSect[MAXNPART][NSECT]; //num WC hits per sector per //particle in evt Int_t nHitsWCPerCham[MAXNPART][NSECT][NCHAM]; //num WC hits per chamber per //particle in evt Int_t nHitsWCPerSlyr[MAXNPART][NSECT][NCHAM][NSLYR]; //num WC hits per superlayer per //particle in evt Int_t WCKey[MAXNPART][MAXNWCHIT]; //TBLKey value for each WC hit in //evt Int_t WCTDC[MAXNPART][MAXNWCHIT]; //TDC value for each WC hit in evt Float_t WCDis[MAXNPART][MAXNWCHIT]; //(signed) distance of hit from //corresponding sense wire for each // WC hit in evt: // + --> along the +xWC-axis // - --> along the -xWC_axis //*************************************************************************** //* SC-specific and event-specific variables * //*************************************************************************** const Int_t MAXNSCHIT=5; //max num of SC hits per particle //in evt Int_t nHitsSCTotal[MAXNPART]; //total SC hits per particle in evt Int_t nHitsSCPerSect[MAXNPART][NSECT]; //num SC hits per sector per //particle in evt Int_t SCSect[MAXNPART][MAXNSCHIT]; //sector of hit SC Int_t SCNum[MAXNPART][MAXNSCHIT]; //num of hit SC Int_t SCTDCTop[MAXNPART][MAXNSCHIT]; //top TDC Int_t SCTDCBot[MAXNPART][MAXNSCHIT]; //bottom TDC Int_t SCADCTop[MAXNPART][MAXNSCHIT]; //top ADC Int_t SCADCBot[MAXNPART][MAXNSCHIT]; //bottom ADC Float_t SCDisTop[MAXNPART][MAXNSCHIT]; //distance from entry SC pos to //top of SC Float_t SCDisBot[MAXNPART][MAXNSCHIT]; //distance from entry SC pos to //bottom of SC Float_t SCMom[MAXNPART][MAXNSCHIT]; //particle mom entering SC Float_t SCELoss[MAXNPART][MAXNSCHIT]; //energy lost in SC Float_t SCTOF[MAXNPART][MAXNSCHIT]; //time of flight from target to SC Float_t SCTrkLen[MAXNPART][MAXNSCHIT]; //length of track from target to SC Float_t SCDetTrkLen[MAXNPART][MAXNSCHIT]; //length of track inside SC //*************************************************************************** //* CC-specific and event-specific variables * //*************************************************************************** const Int_t MAXNCCHIT=5; //max num of CC hits per particle //in evt Int_t nHitsCCTotal[MAXNPART]; //total CC hits per particle in evt Int_t nHitsCCPerSect[MAXNPART][NSECT]; //num CC hits per sector per //particle in evt Int_t CCSect[MAXNPART][MAXNCCHIT]; //sector of hit CC Int_t CCNum[MAXNPART][MAXNCCHIT]; //num of hit CC Int_t CCADC[MAXNPART][MAXNCCHIT]; //ADC Float_t CCDisTop[MAXNPART][MAXNCCHIT]; //distance from entry CC pos to //top of CC Float_t CCDisBot[MAXNPART][MAXNCCHIT]; //distance from entry CC pos to //bottom of CC Float_t CCMom[MAXNPART][MAXNCCHIT]; //particle mom entering CC Float_t CCBeta[MAXNPART][MAXNCCHIT]; //beta value of particle in evt Float_t CCELoss[MAXNPART][MAXNCCHIT]; //energy lost in CC Float_t CCTOF[MAXNPART][MAXNCCHIT]; //time of flight from target to CC Float_t CCTrkLen[MAXNPART][MAXNCCHIT]; //length of track from target to CC Float_t CCDetTrkLen[MAXNPART][MAXNCCHIT]; //length of track inside CC //*************************************************************************** //* NC-specific and event-specific variables * //*************************************************************************** const Int_t MAXNNCHIT=5; //max num of NC hits per particle //in evt Int_t nHitsNCTotal[MAXNPART]; //total NC hits per particle in evt Int_t nHitsNCPerSect[MAXNPART][NSECT]; //num NC hits per sector per //particle in evt Int_t NCSect[MAXNPART][MAXNNCHIT]; //sector of hit NC Int_t NCNum[MAXNPART][MAXNNCHIT]; //num of hit NC Int_t NCTDCTop[MAXNPART][MAXNNCHIT]; //top TDC Int_t NCTDCBot[MAXNPART][MAXNNCHIT]; //bottom TDC Int_t NCADCTop[MAXNPART][MAXNNCHIT]; //top ADC Int_t NCADCBot[MAXNPART][MAXNNCHIT]; //bottom ADC Float_t NCDisTop[MAXNPART][MAXNNCHIT]; //distance from entry NC pos to //top of NC Float_t NCDisBot[MAXNPART][MAXNNCHIT]; //distance from entry NC pos to //bottom of NC Float_t NCMom[MAXNPART][MAXNNCHIT]; //particle mom entering NC Float_t NCELoss[MAXNPART][MAXNNCHIT]; //energy lost in NC Float_t NCTOF[MAXNPART][MAXNNCHIT]; //time of flight from target to NC Float_t NCTrkLen[MAXNPART][MAXNNCHIT]; //length of track from target to NC Float_t NCDetTrkLen[MAXNPART][MAXNNCHIT]; //length of track inside NC //*************************************************************************** //* LD-specific and event-specific variables * //*************************************************************************** const Int_t MAXNLDHIT=5; //max num of LD hits per particle //in evt Int_t nHitsLDTotal[MAXNPART]; //total LD hits per particle in evt Int_t nHitsLDPerSect[MAXNPART][NSECT]; //num LD hits per sector per //particle in evt Int_t LDSect[MAXNPART][MAXNLDHIT]; //sector of hit LD Int_t LDNum[MAXNPART][MAXNLDHIT]; //num of hit LD Int_t LDTDCTop[MAXNPART][MAXNLDHIT]; //top TDC Int_t LDTDCBot[MAXNPART][MAXNLDHIT]; //bottom TDC Int_t LDADCTop[MAXNPART][MAXNLDHIT]; //top ADC Int_t LDADCBot[MAXNPART][MAXNLDHIT]; //bottom ADC Float_t LDDisTop[MAXNPART][MAXNLDHIT]; //distance from entry LD pos to //top of LD Float_t LDDisBot[MAXNPART][MAXNLDHIT]; //distance from entry LD pos to //bottom of LD Float_t LDMom[MAXNPART][MAXNLDHIT]; //particle mom entering LD Float_t LDELoss[MAXNPART][MAXNLDHIT]; //energy lost in LD Float_t LDTOF[MAXNPART][MAXNLDHIT]; //time of flight from target to LD Float_t LDTrkLen[MAXNPART][MAXNLDHIT]; //length of track from target to LD Float_t LDDetTrkLen[MAXNPART][MAXNLDHIT]; //length of track inside LD Char_t str[256]; ifstream outFile("event.dgen"); //*************************************************************************** //*************************************************************************** //* Initialize some variables * //*************************************************************************** for(Int_t part=0;part>str>>nEvent){ for(Int_t i=0;i>kineVal[i]; outFile.ignore(); outFile>>nHitsWCEvt>>nHitsSCEvt>>nHitsCCEvt>>nHitsNCEvt>>nHitsLDEvt; outFile.ignore(); //************************************************************************* //* The vertex and initial momentum of every particle in the reaction is * //* always given for every event, even if that particle never hit a * //* detector * //************************************************************************* for(Int_t part=0;part>str>>str; for(Int_t j=0;j<3;++j) outFile>>vertex[part][j]; for(Int_t j=0;j<3;++j) outFile>>mom[part][j]; outFile.ignore(); //*********************************************************************** //* For each particle in the event, detector hit information will * //* appear only if that particle hit the detector type in question * //*********************************************************************** Char_t nextChar=outFile.peek(); while((nextChar!='P')&&(nextChar!='E')&&(!outFile.eof())){ Char_t detName[2]; outFile>>detName; //********************************************************************* //* Read out WC information for the particle and event * //********************************************************************* if(!strcmp(detName,"WC")){ for(Int_t j=0;j>nHitsWCPerSect[part][j]; for(Int_t j=0;j>nHitsWCPerCham[part][j][k]; for(Int_t j=0;j>nHitsWCPerSlyr[part][j][k][l]; outFile.ignore(); nHitsWCTotal[part]=nHitsWCPerSect[part][0]+nHitsWCPerSect[part][1]; for(Int_t j=0;j>WCKey[part][j]>>WCTDC[part][j]>>WCDis[part][j]; outFile.ignore(); } } //********************************************************************* //* Read out SC information for the particle and event * //********************************************************************* if(!strcmp(detName,"SC")){ for(Int_t j=0;j>nHitsSCPerSect[part][j]; outFile.ignore(); nHitsSCTotal[part]=nHitsSCPerSect[part][0]+nHitsSCPerSect[part][1]; for(Int_t j=0;j>SCSect[part][j]>>SCNum[part][j]>>SCTDCTop[part][j]; outFile>>SCTDCBot[part][j]>>SCADCTop[part][j]>>SCADCBot[part][j]; outFile>>SCDisTop[part][j]>>SCDisBot[part][j]>>SCMom[part][j]; outFile>>SCELoss[part][j]>>SCTOF[part][j]>>SCTrkLen[part][j]; outFile>>SCDetTrkLen[part][j]; outFile.ignore(); /*cout<>nHitsCCPerSect[part][j]; outFile.ignore(); //cout<>CCSect[part][j]>>CCNum[part][j]>>CCADC[part][j]; outFile>>CCDisTop[part][j]>>CCDisBot[part][j]>>CCMom[part][j]; outFile>>CCBeta[part][j]>>CCELoss[part][j]>>CCTOF[part][j]; outFile>>CCTrkLen[part][j]>>CCDetTrkLen[part][j]; outFile.ignore(); /*cout<>nHitsNCPerSect[part][j]; outFile.ignore(); //cout<>NCSect[part][j]>>NCNum[part][j]>>NCTDCTop[part][j]; outFile>>NCTDCBot[part][j]>>NCADCTop[part][j]>>NCADCBot[part][j]; outFile>>NCDisTop[part][j]>>NCDisBot[part][j]>>NCMom[part][j]; outFile>>NCELoss[part][j]>>NCTOF[part][j]>>NCTrkLen[part][j]; outFile>>NCDetTrkLen[part][j]; outFile.ignore(); /*cout<>nHitsLDPerSect[part][j]; outFile.ignore(); //cout<>LDSect[part][j]>>LDNum[part][j]>>LDTDCTop[part][j]; outFile>>LDTDCBot[part][j]>>LDADCTop[part][j]>>LDADCBot[part][j]; outFile>>LDDisTop[part][j]>>LDDisBot[part][j]>>LDMom[part][j]; outFile>>LDELoss[part][j]>>LDTOF[part][j]>>LDTrkLen[part][j]; outFile>>LDDetTrkLen[part][j]; outFile.ignore(); /*cout<0){ cout<<" Total hits : "<0){ cout<<" Total hits : "<0){ cout<<" Total hits : "<0){ cout<<" Total hits : "<0){ cout<<" Total hits : "<