DSTUtil::Calo Namespace Reference


Functions

int GetHCALEnergy (const MIPPEventSummary *evt, float ptt, float hcE[2])
 Function returns the HCAL energy.
int MakeTrkEMCalMatch (const MIPPEventSummary *evt, const MIPPTrackSummary *trk, float shXYEn[4], int shInd[2])
 Function makes track - emcal matching for the specified track If match is on then return the shower position and energy.
int IsTrkHasCloseTrk (const MIPPEventSummary *evt, const MIPPTrackSummary *, int it)
 Function makes test for the presence of another track within 10 cm at EMCAL area.
int GetEMCalHCalEnergies (float sumADC[2], float calE[2], int cid)
int GetCalEnergy (const MIPPEventSummary *evt, float calE[3])
int NumTrksHCAL (const MIPPEventSummary *evt)
 Function calculate the number of tracks in HCAL aperture (+/-55 cm).


Function Documentation

int DSTUtil::Calo::GetHCALEnergy ( const MIPPEventSummary evt,
float  ptt,
float  hcE[2] 
)

Function returns the HCAL energy.

Definition at line 518 of file DSTUtil.cxx.

References MIPPEventSummary::GetHCal(), MIPPHCalSummary::hcalADC, RIMCConfig::kMCRunOffset, MIPPEventSummary::NHCal(), and MIPPEventSummary::run.

Referenced by NuMIPID::Fill(), fillCALOSummary(), and main().

00519 {
00520 
00521   // HCAL ADC corrections made by using the minimum ionizing tracks (muons)
00522   // float corrADC[8]={0.77,1.43,0.54,1.28,1.53,1.72,0.78,0.87};
00523   // Apply the gain correction using 120 protons, where PMT's East - West 
00524   // balancing was made by cumulative approach
00525   float corrADC[8]={0.77515,1.2456,0.444,1.33006,1.1326,1.58409,1.2915,1.0058};
00526   float hcalsum=0.0; 
00527   // scale factor derived from 58 GeV/c and 120 GeV/c hadrons data 
00528   // Apply the HCAL energy scale dependable to the track momentum
00529   // energyscale = (16.5275 -0.0148231 * ptot)/1000.
00530   double enScale[2] = {16.5275, -0.0148231}; // for data and MC use
00531   double energyscale = 14.80357;   // default for 120 GeV/c protons
00532 
00533   energyscale = 14.80357;
00534   if(ptt<140.) energyscale = (enScale[0] + enScale[1]*ptt)/1000.;
00535 
00536  
00537   hcE[0] = 0.;
00538   hcE[1] = 0.;
00539 
00540   if(evt->NHCal()<1) return 9;    // there is no data
00541 
00542   MIPPHCalSummary* fHCal = evt->GetHCal(0);
00543   for(int j=0; j<8; ++j) {
00544     if(fHCal->hcalADC[j] > 0) {
00545       if (evt->run < RIMCConfig::kMCRunOffset) 
00546     hcalsum += (fHCal->hcalADC[j])*corrADC[j];
00547       else 
00548     hcalsum += fHCal->hcalADC[j];
00549     }
00550   } // end j loop
00551   hcE[0] = hcalsum * energyscale;    // GeV units
00552   hcE[1] = hcalsum;                  // raw ADC sum
00553 
00554   return 0;
00555 
00556 
00557 } // end GetHCALEnergy function

int DSTUtil::Calo::MakeTrkEMCalMatch ( const MIPPEventSummary evt,
const MIPPTrackSummary trk,
float  shXYEn[4],
int  shInd[2] 
)

Function makes track - emcal matching for the specified track If match is on then return the shower position and energy.

Definition at line 564 of file DSTUtil.cxx.

References ds, ecalEventNum, MIPPEventSummary::ECalNumShwX, MIPPEventSummary::ECalNumShwY, MIPPTrackSummary::emcalx, MIPPEventSummary::evtnum, MIPPEventSummary::GetCalo(), MIPPEventSummary::NCalo(), numshx, numshy, MIPPTrackSummary::ptot, shenx, sheny, shx, and shy.

Referenced by NuMIPID::Fill(), fillCALOSummary(), main(), and RICHPid::MakeWeightedHists().

00565 {
00566 
00567   // scale factor derived from 58 GeV/c and 120 GeV/c hadron data 
00568   double enEmcal[2] = {0.33083,  0.001748061}; // valid for data and MC
00569   double emscfactor=0.53413; // default for 120 GeV/c protons (in MeV)  
00570   emscfactor = (enEmcal[0] + enEmcal[1]*trk->ptot)/1000.;  // now in GeV
00571   //float emcalSum=0.0;
00572   float pmatchWin[6] = {8., 6., 4., 3., 2., 1.};
00573   float dxx,dyy,dss[2]={5.0, 6.0};
00574 
00575   if(evt->evtnum != ecalEventNum) {  // is it same event?
00576     ecalEventNum = evt->evtnum;
00577 // use codes below only for the first call in event
00578     if(evt->NCalo() < 1) {
00579       numshx = 0;
00580       numshy = 0;
00581       shXYEn[0] = 200.;
00582       shXYEn[1] = 210.;
00583       shXYEn[2] = 0.;
00584       shXYEn[3] = 0.;
00585       shInd[0]  = -1;
00586       shInd[1]  = -2;
00587       return 9;
00588     } // end if(evt->NCalo() < 1) statement
00589 
00590     numshx = evt->ECalNumShwX;
00591     numshy = evt->ECalNumShwY;
00592     for(int ical=0; ical < evt->NCalo(); ++ical) {
00593       MIPPCaloSummary* fcal = evt->GetCalo(ical);
00594       shx[ical] = fcal->EShXP;
00595       shy[ical] = fcal->EShYP;
00596       shenx[ical] = fcal->EShXEn;
00597       sheny[ical] = fcal->EShYEn;
00598     } // end ical loop
00599   } // end if(evt->evtnum != ecalEventNum) statement
00600 
00601   if(numshx==0 || numshy==0) {  // do not make match if one of them is 0
00602     shXYEn[0] = 200.;
00603     shXYEn[1] = 210.;
00604     shXYEn[2] = 0.;
00605     shXYEn[3] = 0.;
00606     shInd[0]  = -1;
00607     shInd[1]  = -2;
00608     return 9;
00609   } // end if(numshx==0 || numshy==0) statement
00610 
00611   // now start actual matching
00612   int jmom,jx,jy;
00613   float ds, dx, dy;
00614   jmom = int(trk->ptot/10.0);
00615   if(jmom < 0) jmom = 0;
00616   if(jmom > 5) jmom = 5;
00617   jx = -1;
00618   jy = -1;
00619   // apply momentum dependence for the matching window
00620   dxx = dss[0] + pmatchWin[jmom];
00621   ds = 100.;
00622   for(int ix=0; ix<numshx; ++ix) {
00623     dx = fabs(trk->emcalx[0]-shx[ix]);
00624     if(dx<ds && dx<dxx) { // match is on
00625       jx = ix;
00626       ds = dx;
00627     } // end if(dx<ds && dx<dxx) test
00628   } // end ix loop
00629   if(ds<dxx && jx>-1) { // closest match in X is found
00630 
00631     // now in Y-view
00632     dyy = dss[1] + pmatchWin[jmom];
00633     ds = 100.;
00634     for(int iy=0; iy<numshy; ++iy) {
00635       dy = fabs(trk->emcalx[1]-shy[iy]);
00636       if(dy<dyy && dy<ds) {  //match is on
00637     jy = iy;
00638     ds = dy;
00639       } // end match test
00640     } // end iy loop
00641     if(ds<dyy && jy>-1) { // closest match in Y view is found
00642 
00643       // now place positions and calculate an energy in GeV
00644       shXYEn[0] = shx[jx];
00645       shXYEn[1] = shy[jy];
00646       float shC = shenx[jx] + sheny[jy];
00647       shXYEn[2] = emscfactor*shC;
00648       shXYEn[3] = shC;      // raw ADC sum
00649       shInd[0]  = jx;
00650       shInd[1]  = jy;
00651 
00652     } // end if(ds<dyy && jy>-1) statement
00653   } // end if(ds<dxx && jx>-1) statement
00654 
00655   if(jx == -1 || jy == -1) {
00656     shXYEn[0] = 200.;
00657     shXYEn[1] = 210.;
00658     shXYEn[2] = 0.;
00659     shXYEn[3] = 0.;
00660     shInd[0]  = -1;
00661     shInd[1]  = -2;
00662     return 9;
00663   } // if(jx == -1 || jy == -1) statement
00664 
00665   return 0;  // match is found, variables are filled above
00666 
00667 } // end MakeTrkEMCalMatch function

int DSTUtil::Calo::IsTrkHasCloseTrk ( const MIPPEventSummary evt,
const MIPPTrackSummary trk,
int  it 
)

Function makes test for the presence of another track within 10 cm at EMCAL area.

Definition at line 674 of file DSTUtil.cxx.

References MIPPEventSummary::evtnum, MIPPEventSummary::GetTrk(), MIPPEventSummary::NTrk(), nTrks, nTrksAtEmcal, trkEventNum, xEmf, and yEmf.

Referenced by main().

00677 {
00678  
00679   float howClose=10.0, xEmTrk[300], yEmTrk[300];
00680   if(evt->evtnum != trkEventNum) { 
00681     trkEventNum = evt->evtnum;
00682 // use below codes only for the first call in event
00683     int nTrks = evt->NTrk();
00684     if(nTrks > 300) nTrks = 300; // what is a size of the track bank?
00685     if(nTrks < 2) return 0;      // nothing to do if nTrks < 2
00686 
00687     // Find how many tracks pointing to the EMCal area
00688     // apply loose cuts for tracks, do not apply RICH window cut
00689     nTrksAtEmcal = 0;
00690     int wc4, wc5, wc6;
00691     for(int i=0; i<nTrks; ++i) {
00692       MIPPTrackSummary* trp = evt->GetTrk(i);
00693       xEmf[i] = -1;    // use -1 if track is not pointing to EMCal
00694       yEmf[i] = -1;
00695       xEmTrk[i] = 250.;
00696       yEmTrk[i] = 260.;
00697 
00698       if(trp->avgt < -30. || trp->avgt > 120.) continue;   // test for time
00699       if(trp->ntpchit < 20 || trp->ntpchit > 95) continue; // test space points
00700       wc4 = wc5 = wc6 = 0;
00701       if(trp->nwchits[3] > 0) wc4 = 1;
00702       if(trp->nwchits[4] > 0) wc5 = 1;
00703       if(trp->nwchits[5] > 0) wc6 = 1;
00704       if((wc4+wc5+wc6) < 1) continue;    // at least one downstream WC is on
00705       // position of track at EMCAL
00706       if(fabs(trp->emcalx[0])>85.0 || fabs(trp->emcalx[1])>85.0) continue;
00707 
00708       xEmf[i] = 0;         // track in EMCal area, reset flag to 0
00709       yEmf[i] = 0;
00710       xEmTrk[i] = trp->emcalx[0];
00711       yEmTrk[i] = trp->emcalx[1];
00712       nTrksAtEmcal++;             // count it
00713     } // end track loop
00714 
00715     if(nTrksAtEmcal < 2) {   // if less than 2 tracks, then nothing to compare
00716       return 0;
00717     } else {
00718       // now look in X-view
00719       for(int i1=0; i1<nTrks-1; ++i1) {  // outer loop
00720     if(xEmf[i1] == -1) continue;  // track not at EMCal
00721     for(int i2=i1+1; i2<nTrks; ++i2) { // inner loop
00722       if(xEmf[i2] == -1) continue;  // track not at EMCal
00723       if(fabs(xEmTrk[i1] - xEmTrk[i2])<howClose) { //there are close tracks
00724         xEmf[i1] = 5;  // set found flag for both tracks
00725         xEmf[i2] = 6;
00726       } // end if < 10 test
00727     } // end i2 inner loop
00728       } // end outer i1 loop
00729 
00730       // now in Y-view
00731       for(int i3=0; i3<nTrks-1; ++i3) {
00732     if(yEmf[i3] == -1) continue;
00733     for(int i4=i3+1; i4<nTrks; ++i4) {
00734       if(yEmf[i4] == -1) continue; 
00735       if(fabs(yEmTrk[i3] - yEmTrk[i4])<howClose) {
00736         yEmf[i3] = 7;  
00737         yEmf[i4] = 8;
00738       } // end if < 10 test
00739     } // end i4 loop
00740       } // end i3 loop
00741 
00742     } // end else statement
00743 
00744   } // end if(evt->evtnum != trkEventNum) test
00745 
00746   // usually come here for another calls in event 
00747   int iflag = 0;
00748   if(xEmf[it] > 1 || yEmf[it] > 1) iflag = 9;
00749   return iflag;  // iflag=9 if another close track found 
00750 } // end IsTrkHasCloseTrk function

int DSTUtil::Calo::GetEMCalHCalEnergies ( float  sumADC[2],
float  calE[2],
int  cid 
)

Definition at line 761 of file DSTUtil.cxx.

00762 {
00763   float emcalSF[15]={0.37,0.37,0.37,0.37,0.37,0.37,0.37,0.438,0.489,0.0,
00764            0.41,0.47,0.0,0.43,0.52};
00765   float hcalSF[15]={10.57,10.57,10.57,10.57,10.57,10.57,10.57,15.05,15.01,0.0,
00766           15.38,15.26,0.0,15.68,14.95};
00767 
00768   calE[0] = 0.;
00769   calE[1] = 0.;
00770   if(cid<1 || (cid>3 && cid<8) || cid==13 || cid>15) return 9;
00771   if(sumADC[0]<0. || sumADC[1]<0.) return 8;
00772   calE[0] = sumADC[0] * emcalSF[cid-1]/1000.0;  // return in GeV
00773   calE[1] = sumADC[1] * hcalSF[cid-1]/1000.0;   // return in GeV
00774   return 0;
00775 } // end GetEMCalHCalEnergies function

int DSTUtil::Calo::GetCalEnergy ( const MIPPEventSummary evt,
float  calE[3] 
)

Definition at line 778 of file DSTUtil.cxx.

References MIPPEventSummary::ECalNumShwX, MIPPEventSummary::ECalNumShwY, MIPPCaloSummary::EShXEn, MIPPEventSummary::GetCalo(), MIPPEventSummary::GetHCal(), MIPPHCalSummary::hcalADC, RIMCConfig::kMCRunOffset, MIPPEventSummary::NCalo(), MIPPEventSummary::NHCal(), nShx, nShy, and MIPPEventSummary::run.

Referenced by RICHPid::MakeWeightedHists(), and ValiCham::OneTrackEvent().

00779 {
00780 
00781 // get H & EM Cal Energies based on the Cal Summaries.
00782 // energies are stored in the calE array
00783 // calE[0]  = total HCal
00784 // calE[1] = total EMCal
00785 // calE[2] = total EM+H
00786 
00787   calE[0] = 0.;
00788   calE[1] = 0.;
00789   calE[2] = 0.;
00790 
00791   // don't correct hcal adc's if MC 
00792   bool mcRun = false; 
00793   if (evt->run >= RIMCConfig::kMCRunOffset) mcRun = true;
00794 
00795   // get hcal energy
00796   float sumhcal=0.0, sumHcal=0.0, sfh=14.80357, sfe=0.53413;
00797   float corrADC[8]={0.77515,1.2456,0.444,1.33006,1.1326,1.58409,1.2915,1.0058};
00798 
00799   for(int ical=0; ical<evt->NHCal(); ++ical) {
00800     if (ical > 0) continue; 
00801     MIPPHCalSummary* fHCal = evt->GetHCal(ical);
00802     for(int j=0; j<8; ++j) {
00803       if (mcRun) 
00804         sumhcal += fHCal->hcalADC[j];
00805       else 
00806         sumhcal += (fHCal->hcalADC[j]*corrADC[j]);
00807     } // end j loop
00808   } // end ical loop
00809   sumHcal = sumhcal/1000.;
00810   calE[0] = sumHcal*sfh;
00811 
00812   // get emcal energy 
00813   int nShx = evt->ECalNumShwX;
00814   int nShy = evt->ECalNumShwY;
00815   float emXen = 0.0, emYen = 0.0;
00816   
00817   for(int ical=0; ical < evt->NCalo(); ++ical) {
00818     MIPPCaloSummary* fcal = evt->GetCalo(ical);
00819     if(ical < nShx) emXen += fcal->EShXEn;
00820     if(ical < nShy) emYen += fcal->EShYEn;
00821   } // end ical loop
00822   calE[1] = (emXen + emYen)*sfe/1000.; // total EMCal Energy in GeV
00823   if (calE[1] < 0.) calE[1] = 0.0;  
00824  
00825   // total cal energy 
00826   calE[2] = calE[0] + calE[1]; // total CAL energy in GeV
00827   
00828   return 0;
00829 }

int DSTUtil::Calo::NumTrksHCAL ( const MIPPEventSummary evt  ) 

Function calculate the number of tracks in HCAL aperture (+/-55 cm).

Definition at line 833 of file DSTUtil.cxx.

References MIPPEventSummary::GetTrk(), MIPPEventSummary::NTrk(), and nTrks.

Referenced by fillCALOSummary(), and main().

00834 {
00835   int nTrks = 0, wc4,wc5,wc6;
00836   for (int i = 0; i < evt->NTrk(); ++i) {
00837     MIPPTrackSummary* trk = evt->GetTrk(i);
00838     if(trk->avgt < -30. || trk->avgt > 120.) continue;   // test for time
00839     if(trk->ntpchit < 20 || trk->ntpchit > 95) continue; // test space points
00840     wc4 = wc5 = wc6 = 0;
00841     if(trk->nwchits[3] > 0) wc4 = 1;
00842     if(trk->nwchits[4] > 0) wc5 = 1;
00843     if(trk->nwchits[5] > 0) wc6 = 1;
00844     if((wc4+wc5+wc6) < 1) continue;    // at least one downstream WC is on
00845     // position of track at HCAL
00846     if(fabs(trk->hcalx[0])>55.0 || fabs(trk->hcalx[1])>55.0) continue;
00847     nTrks++;
00848   }
00849   return nTrks;
00850 
00851 } // end NumTrksHCAL function


Generated on Mon Nov 23 08:05:24 2009 for MIPP(E907) by  doxygen 1.4.7