Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

AcdValsTool Class Reference

Calculates Acd Values. More...

Inheritance diagram for AcdValsTool:

Inheritance graph
[legend]
Collaboration diagram for AcdValsTool:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 AcdValsTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~AcdValsTool ()
StatusCode initialize ()
StatusCode calculate ()
 calculate all values; implemented by each XxxValsTool

void tkrHitsCount ()
void setId (const std::vector< Event::AcdTkrIntersection * > vertexUp, const std::vector< Event::AcdTkrIntersection * > vertexDown, const std::vector< Event::AcdTkrIntersection * > trackUp, const std::vector< Event::AcdTkrIntersection * > trackDown, unsigned int &retId, bool findRibbon=false)
void findId (const std::vector< Event::AcdTkrIntersection * > vec, idents::AcdId &retId, bool findRibbon=false)
void reconId (const Event::AcdRecon *pACD)

Private Attributes

unsigned int ACD_Tile_Count
unsigned int ACD_Ribbon_Count
float ACD_Total_Energy
float ACD_Total_Ribbon_Energy
unsigned int ACD_TileIdRecon
unsigned int ACD_RibbonIdRecon
int ACD_ActiveDist_TrackNum
float ACD_ActiveDist3D
float ACD_ActiveDist3D_Err
float ACD_ActiveDist_Energy
float ACD_ribbon_ActiveDist
float ACD_ribbon_ActiveDist_Err
float ACD_ribbon_ActiveLength
float ACD_ribbon_EnergyPmtA
float ACD_ribbon_EnergyPmtB
float ACD_Corner_DOCA
float ACD_TkrHole_Dist
float ACD_TkrRibbon_Dist
float ACD_TkrRibbonLength
float ACD_Tkr1ActiveDist
float ACD_Tkr1ActiveDist_Err
float ACD_Tkr1ActiveDist_Energy
float ACD_Tkr1_ribbon_ActiveDist
float ACD_Tkr1_ribbon_ActiveDist_Err
float ACD_Tkr1_ribbon_ActiveLength
float ACD_Tkr1_ribbon_EnergyPmtA
float ACD_Tkr1_ribbon_EnergyPmtB
float ACD_Tkr1Corner_DOCA
float ACD_Tkr1Hole_Dist
float ACD_Tkr1Ribbon_Dist
float ACD_Tkr1RibbonLength
float ACD_VtxActiveDist
float ACD_VtxActiveDist_Energy
float ACD_VtxActiveDist_Down
float ACD_VtxActiveDist_EnergyDown
unsigned int ACD_tileTopCount
unsigned int ACD_tileCount0
unsigned int ACD_tileCount1
unsigned int ACD_tileCount2
unsigned int ACD_tileCount3
unsigned int ACD_countRow3Readout
float ACD_energyTop
float ACD_energyRow0
float ACD_energyRow1
float ACD_energyRow2
float ACD_energyRow3
IGlastDetSvc * m_detSvc
double m_vetoThresholdMeV

Detailed Description

Calculates Acd Values.

Definition at line 45 of file AcdValsTool.cxx.


Constructor & Destructor Documentation

AcdValsTool::AcdValsTool const std::string &  type,
const std::string &  name,
const IInterface *  parent
 

Definition at line 274 of file AcdValsTool.cxx.

References m_vetoThresholdMeV.

00277                          : ValBase( type, name, parent )
00278 {    
00279     // Declare additional interface
00280     declareInterface<IValsTool>(this); 
00281 
00282     // in MeV
00283     declareProperty("VetoThresholdMeV", m_vetoThresholdMeV=0.0);
00284 }

virtual AcdValsTool::~AcdValsTool  )  [inline, virtual]
 

Definition at line 53 of file AcdValsTool.cxx.

00053 { }


Member Function Documentation

StatusCode AcdValsTool::calculate  )  [virtual]
 

calculate all values; implemented by each XxxValsTool

Reimplemented from ValBase.

Definition at line 383 of file AcdValsTool.cxx.

References ACD_ActiveDist3D, ACD_ActiveDist3D_Err, ACD_ActiveDist_Energy, ACD_ActiveDist_TrackNum, ACD_Corner_DOCA, ACD_countRow3Readout, ACD_energyRow0, ACD_energyRow1, ACD_energyRow2, ACD_energyRow3, ACD_energyTop, ACD_ribbon_ActiveDist, ACD_ribbon_ActiveDist_Err, ACD_ribbon_ActiveLength, ACD_Ribbon_Count, ACD_ribbon_EnergyPmtA, ACD_ribbon_EnergyPmtB, ACD_Tile_Count, ACD_tileCount0, ACD_tileCount1, ACD_tileCount2, ACD_tileCount3, ACD_tileTopCount, ACD_Tkr1_ribbon_ActiveDist, ACD_Tkr1_ribbon_ActiveDist_Err, ACD_Tkr1_ribbon_ActiveLength, ACD_Tkr1_ribbon_EnergyPmtA, ACD_Tkr1_ribbon_EnergyPmtB, ACD_Tkr1ActiveDist, ACD_Tkr1ActiveDist_Energy, ACD_Tkr1ActiveDist_Err, ACD_Tkr1Corner_DOCA, ACD_Tkr1Hole_Dist, ACD_Tkr1Ribbon_Dist, ACD_Tkr1RibbonLength, ACD_TkrHole_Dist, ACD_TkrRibbon_Dist, ACD_TkrRibbonLength, ACD_Total_Energy, ACD_Total_Ribbon_Energy, ACD_VtxActiveDist, ACD_VtxActiveDist_Down, ACD_VtxActiveDist_Energy, ACD_VtxActiveDist_EnergyDown, ValBase::m_pEventSvc, and reconId().

00384 {
00385     StatusCode sc = StatusCode::SUCCESS;
00386 
00387     // Recover pointers to ACD Recon results
00388     SmartDataPtr<Event::AcdRecon> pACD(m_pEventSvc,EventModel::AcdRecon::Event);
00389     // Recover pointers to CalClusters and Xtals
00390     SmartDataPtr<Event::CalClusterCol>     
00391         pCals(m_pEventSvc,EventModel::CalRecon::CalClusterCol);
00392 
00393     // Recover Track associated info. (not currently used 
00394     //SmartDataPtr<Event::TkrFitTrackCol>  pTracks(m_pEventSvc,EventModel::TkrRecon::TkrFitTrackCol);
00395     //SmartDataPtr<Event::TkrVertexCol>    pVerts(m_pEventSvc,EventModel::TkrRecon::TkrVertexCol);
00396     // Recover pointer to ACD info  
00397 
00398     //Make sure we have valid ACD data
00399     if (pACD)
00400     {
00401         reconId(pACD);
00402 
00403         // Make a map relating AcdId to energy in the tile
00404         std::map<idents::AcdId, double> tileEnergyIdMap;
00405         std::map<idents::AcdId, std::pair<double,double> > ribbonEnergyIdMap;
00406 
00407         const Event::AcdHitCol& hitCol = pACD->getAcdHitCol();
00408         int nHit = hitCol.size();
00409 
00410         static const float MeVMipTile10 = 1.9;
00411         static const float MeVMipTile12 = 2.28;
00412         static const float MeVMipRibbon = 0.5;
00413         static const float TileCountThreshold = 0.8;
00414 
00415         ACD_Total_Ribbon_Energy = 0.;
00416         ACD_Tile_Count = 0;
00417         ACD_Ribbon_Count = 0;
00418 
00419         // Loop over the hits and fill the maps
00420         for (int iHit(0); iHit < nHit; iHit++ ){
00421             const Event::AcdHit* aHit = hitCol[iHit];
00422             const idents::AcdId& id = aHit->getAcdId();
00423             if ( id.na() ) {
00424                 continue;
00425             } else if ( id.ribbon() ) {
00426                 float MeV_A = aHit->mips(Event::AcdHit::A) * MeVMipRibbon;
00427                 float MeV_B = aHit->mips(Event::AcdHit::B) * MeVMipRibbon;
00428                 ACD_Total_Ribbon_Energy += (MeV_A + MeV_B);
00429                 ribbonEnergyIdMap[id] = std::pair<double,double>(MeV_A,MeV_B);
00430                 ACD_Ribbon_Count++;
00431             } else {
00432                 // check for 10mm v. 12mm tiles
00433                 float MeVMip = id.top() && id.row() == 2 ? MeVMipTile12 : MeVMipTile10;
00434                 float MeV = aHit->mips() * MeVMip;
00435                 ACD_Total_Energy += MeV;
00436                 tileEnergyIdMap[id] = MeV;
00437                 ACD_Tile_Count++;
00438 
00439                 // WBA: Insert the Tile_counts_by region here with energy threshold
00440                 if(MeV > TileCountThreshold) {
00441                     if(id.top()) {ACD_tileTopCount += 1.0;}
00442                     else {
00443                         if(id.row()==0) ACD_tileCount0 += 1.0;
00444                         if(id.row()==1) ACD_tileCount1 += 1.0;
00445                         if(id.row()==2) ACD_tileCount2 += 1.0;
00446                         if(id.row()==3) ACD_tileCount3 += 1.0;
00447                     }
00448                 } 
00449 
00450 
00451                 // Bill's new variables 17-Jul-2008
00452                 if(id.top()) {ACD_energyTop  += MeV;}
00453                 else {
00454                     if(id.row()==0) ACD_energyRow0 += MeV;
00455                     if(id.row()==1) ACD_energyRow1 += MeV;
00456                     if(id.row()==2) ACD_energyRow2 += MeV;
00457                     if(id.row()==3) {
00458                         ACD_energyRow3 += MeV;
00459                         ACD_countRow3Readout += 1.0;
00460                     }
00461                 }
00462             }     
00463         }
00464 
00465         //Make sure we have valid cluster data and some energy
00466         double CAL_EnergyRaw = 10.; //Default min. Event Energy
00467         if (pCals) {
00468             if (!pCals->empty()) {
00469                 Event::CalCluster* calCluster = pCals->front();
00470                 CAL_EnergyRaw  = calCluster->getCalParams().getEnergy();
00471             }
00472         }
00473         // Find *Safe* Active Distance for this event given the energy
00474         double min_ActiveDistance = -300./sqrt(CAL_EnergyRaw/100); //-300mm @ 100 MeV
00475 
00476         // Reset variables for loop over all tracks
00477         ACD_ActiveDist3D = ACD_ribbon_ActiveDist = -2000.;
00478         ACD_ActiveDist_Energy = ACD_ribbon_EnergyPmtA = ACD_ribbon_EnergyPmtB = 0.;
00479         ACD_ActiveDist3D_Err = ACD_ribbon_ActiveDist_Err = -1.; 
00480         ACD_Corner_DOCA = ACD_TkrRibbon_Dist = ACD_TkrHole_Dist = -2000.;
00481         ACD_ribbon_ActiveLength = ACD_TkrRibbonLength = -10000.;
00482 
00483         // Reset variables for best track
00484         ACD_Tkr1ActiveDist = ACD_Tkr1_ribbon_ActiveDist = -2000.;
00485         ACD_Tkr1ActiveDist_Energy = ACD_Tkr1_ribbon_EnergyPmtA 
00486             = ACD_Tkr1_ribbon_EnergyPmtB = 0.;
00487         ACD_Tkr1ActiveDist_Err = ACD_Tkr1_ribbon_ActiveDist_Err = -1.;
00488         ACD_Tkr1Corner_DOCA = ACD_Tkr1Ribbon_Dist = ACD_Tkr1Hole_Dist = -2000.;
00489         ACD_Tkr1_ribbon_ActiveLength = ACD_Tkr1RibbonLength = -10000.;
00490 
00491         // Reset vertex variables
00492         ACD_VtxActiveDist = ACD_VtxActiveDist_Down = -2000.;
00493         ACD_VtxActiveDist_Energy = ACD_VtxActiveDist_EnergyDown = 0.;
00494 
00495         // LOOP over AcdTkrHitPoca & get least distance sutff
00496         // Note that the Poca are sorted.  
00497         // Once we have filled all the variables we can split
00498         const Event::AcdTkrHitPoca* tile_vetoPoca = 0;
00499         double max_tile_energy = 0.; 
00500 
00501         const Event::AcdTkrHitPocaCol& pocas = pACD->getAcdTkrHitPocaCol();
00502         Event::AcdTkrHitPocaCol::const_iterator itrPoca = pocas.begin();
00503         for ( ; itrPoca != pocas.end(); itrPoca++ ) {
00504 
00505             const Event::AcdTkrHitPoca* aPoca = (*itrPoca);
00506             // check to see if this is the vertex (-1) 
00507             // or the best track (0) and direction
00508             bool isVertex = aPoca->trackIndex() == -1;
00509             bool isBestTrack = aPoca->trackIndex() == 0;
00510             bool isUpGoing = aPoca->getArcLength() > 0.;
00511             bool isTrack = aPoca->trackIndex() >= 0;
00512 
00513             bool doneHole = false;
00514             double holeDoca(0.), holeDocaError(0.); 
00515             int iHole = -1;
00516 
00517             bool donePlaneError = false;
00518             double planeError = 0.;
00519 
00520             // get the id
00521             idents::AcdId theId = aPoca->getId();
00522 
00523             if ( isUpGoing && isTrack) {
00524                 // Fill variables for all tracks
00525                 if ( theId.tile() ) {
00526                     if ( ACD_ActiveDist3D < -1999.99 
00527                         || aPoca->getDoca() > min_ActiveDistance) 
00528                     {
00529                         if(tileEnergyIdMap[theId] > max_tile_energy ) {
00530                             max_tile_energy = tileEnergyIdMap[theId];
00531                             tile_vetoPoca = aPoca;
00532                             ACD_ActiveDist3D = aPoca->getDoca();
00533                         }
00534                     }   
00535                 } else if ( theId.ribbon() ) {
00536                     if ( ACD_ribbon_ActiveDist < -1999.99 ) {
00537                         if ( ! donePlaneError ) {
00538                             donePlaneError = true;
00539                             AcdTileUtil::planeErrorProjection(
00540                                 aPoca->getActiveX(),aPoca->getActiveY(),
00541                                 aPoca->getLocalXXCov(),aPoca->getLocalYYCov(),
00542                                 planeError);  
00543                         }
00544                         ACD_ribbon_ActiveDist =  aPoca->getDoca();
00545                         ACD_ribbon_ActiveDist_Err = planeError;
00546                         ACD_ribbon_ActiveLength = aPoca->getActiveY();
00547                         ACD_ribbon_EnergyPmtA = ribbonEnergyIdMap[theId].first;
00548                         ACD_ribbon_EnergyPmtB = ribbonEnergyIdMap[theId].second;
00549                     }
00550                 }
00551                 // Fill variables for best track, if appropiate
00552                 if ( isBestTrack ) {
00553                     // check tile or ribbon
00554                     if ( theId.tile() ) {
00555                         // check to see if vars already filled
00556                         if ( ACD_Tkr1ActiveDist < -1999.99 ) {
00557                             if ( ! doneHole ) {
00558                                 doneHole = true;
00559                                 //AcdTileUtil::tileScrewHoleDoca(aPoca->getId(),aPoca->getActiveX(),aPoca->getActiveY(),
00560                                 //                                 aPoca->getLocalXXCov(),aPoca->getLocalYYCov(),aPoca->getLocalXYCov(),
00561                                 //                                 holeDoca,holeDocaError,iHole);
00562                             }
00563                             if ( ! donePlaneError ) {
00564                                 donePlaneError = true;
00565                                 AcdTileUtil::planeErrorProjection(
00566                                     aPoca->getActiveX(),aPoca->getActiveY(),
00567                                     aPoca->getLocalXXCov(),aPoca->getLocalYYCov(),
00568                                     planeError);  
00569                             }
00570                             ACD_Tkr1ActiveDist = aPoca->getDoca();
00571                             ACD_Tkr1ActiveDist_Err = planeError;
00572                             ACD_Tkr1ActiveDist_Energy = tileEnergyIdMap[theId];
00573                             ACD_Tkr1Hole_Dist = holeDoca;
00574                         } 
00575                     } else if ( theId.ribbon() ) {
00576                         // check to see if vars already filled
00577                         if ( ACD_Tkr1_ribbon_ActiveDist < -1999.99 ) {
00578                             if ( ! donePlaneError ) {
00579                                 donePlaneError = true;
00580                                 AcdTileUtil::planeErrorProjection(aPoca->getActiveX(),aPoca->getActiveY(),
00581                                     aPoca->getLocalXXCov(),aPoca->getLocalYYCov(),planeError);  
00582                             }
00583                             ACD_Tkr1_ribbon_ActiveDist =  aPoca->getDoca();
00584                             ACD_Tkr1_ribbon_ActiveDist_Err = planeError;
00585                             ACD_Tkr1_ribbon_ActiveLength = aPoca->getActiveY();
00586                             ACD_Tkr1_ribbon_EnergyPmtA = ribbonEnergyIdMap[theId].first;
00587                             ACD_Tkr1_ribbon_EnergyPmtB = ribbonEnergyIdMap[theId].second;
00588                         }
00589                     }
00590                     // Of fill variables for vertex, if appropraite
00591                 } else if ( isVertex ) {
00592                     // only fill this one for tiles
00593                     if ( theId.tile() ) {
00594                         // check to see if vars already filled
00595                         if ( ACD_VtxActiveDist < -1999.99 ) {
00596                             ACD_VtxActiveDist = aPoca->getDoca();
00597                             ACD_VtxActiveDist_Energy = tileEnergyIdMap[theId];
00598                         }
00599                     }
00600                 }
00601             } else {
00602                 // Down going, only fill vertex variables
00603                 if ( isVertex ) {
00604                     // only fill this one for tiles
00605                     if ( theId.tile() ) {
00606                         // check to see if vars already filled
00607                         if ( ACD_VtxActiveDist_Down < -1999.99 ) {
00608                             ACD_VtxActiveDist_Down = aPoca->getDoca();
00609                             ACD_VtxActiveDist_EnergyDown = tileEnergyIdMap[theId];
00610                         }
00611                     }
00612                 }
00613             }
00614         }
00615         // Now fill in the values for the most likely Track-Tile Veto Poca
00616         if(tile_vetoPoca) {
00617             double planeError = 0.;
00618             AcdTileUtil::planeErrorProjection(tile_vetoPoca->getActiveX(),
00619                 tile_vetoPoca->getActiveY(),
00620                 tile_vetoPoca->getLocalXXCov(),
00621                 tile_vetoPoca->getLocalYYCov(),planeError);  
00622             //ACD_ActiveDist3D = tile_vetoPoca->getDoca(); Already done in selection process
00623             ACD_ActiveDist3D_Err = planeError;
00624             idents::AcdId theId = tile_vetoPoca->getId();
00625             ACD_ActiveDist_Energy = tileEnergyIdMap[theId];
00626             ACD_ActiveDist_TrackNum = tile_vetoPoca->trackIndex(); // Index starts from 0
00627             double holeDoca(0.), holeDocaError(0.); 
00628             int iHole = -1;
00629             //AcdTileUtil::tileScrewHoleDoca(aPoca->getId(),aPoca->getActiveX(),aPoca->getActiveY(),
00630             //                             aPoca->getLocalXXCov(),aPoca->getLocalYYCov(),aPoca->getLocalXYCov(),
00631             //                             holeDoca,holeDocaError,iHole);
00632             ACD_TkrHole_Dist = holeDoca;
00633         }
00634 
00635         float  bestCornerGapMeasure= 2000.;
00636 
00637         // loop over AcdGaps & get least distance between track extrapolation 
00638         // & ribbon / corner gaps
00639         const Event::AcdTkrGapPocaCol& gaps = pACD->getAcdTkrGapPocaCol();
00640         Event::AcdTkrGapPocaCol::const_iterator itrGap = gaps.begin();
00641         for ( ; itrGap != gaps.end(); itrGap++ ) {
00642 
00643             // check to see if this is the vertex (-1) 
00644             // or the best track (0) and direction
00645             bool isVertex = (*itrGap)->trackIndex() == -1;
00646             bool isBestTrack = (*itrGap)->trackIndex() == 0;
00647             bool isUpGoing = (*itrGap)->getArcLength() > 0.;
00648             bool isRibbonGap = false;
00649             bool isCornerGap = false;
00650 
00651             // for now we ignore vertex and down going
00652             if ( isVertex || (! isUpGoing) ) continue;
00653 
00654             // Classify gap type
00655             switch ( (*itrGap)->getId().gapType() ) 
00656             {
00657             case 1: //AcdRecon::X_RibbonSide: 
00658             case 2: //AcdRecon::Y_RibbonSide:
00659             case 3: //AcdRecon::Y_RibbonTop:
00660                 isRibbonGap = true;
00661                 break;
00662             case 7: //AcdRecon::CornerRay:
00663                 isCornerGap = true;
00664                 break;
00665             default:
00666                 break;
00667             }
00668 
00669             float gapDoca = (*itrGap)->getDoca();
00670             if ( isRibbonGap ) {
00671                 // Fill variables for best track
00672                 if ( isBestTrack ) {
00673                     if ( gapDoca > ACD_Tkr1Ribbon_Dist ) {
00674                         ACD_Tkr1Ribbon_Dist = gapDoca;
00675                         ACD_Tkr1RibbonLength = (*itrGap)->getActiveY();
00676                     }
00677                 }
00678                 // Fill variables for all tracks
00679                 if ( gapDoca > ACD_TkrRibbon_Dist ) {
00680                     ACD_TkrRibbon_Dist = gapDoca;
00681                     ACD_TkrRibbonLength = (*itrGap)->getActiveY();
00682                 }
00683             } else if ( isCornerGap ) {
00684                 //if ( (*itrGap)->getArcLength() < 0. ) continue;
00685                 if ( isBestTrack ) {
00686                     if ( fabs( gapDoca ) < fabs(ACD_Tkr1Corner_DOCA) ) {
00687                         ACD_Tkr1Corner_DOCA = gapDoca;
00688                     }
00689                 }
00690                 float cornerGapMeasure = gapDoca > 0 ? gapDoca : gapDoca / -5.;
00691                 if ( cornerGapMeasure < bestCornerGapMeasure ) {
00692                     ACD_Corner_DOCA = gapDoca;
00693                     bestCornerGapMeasure = cornerGapMeasure;
00694                 }
00695             }
00696         }    
00697 
00698         /*
00699         // -------------- deleted code! ------------
00700         // use acd_row predicate to count number of tiles per side row
00701         unsigned int m_acd_tileCount[5] = {0,0,0,0,0};
00702         for( int row = -1; row<=3; row++ ) { 
00703             m_acd_tileCount[row+1] = 
00704                 std::count_if(tileEnergyIdMap.begin(), 
00705                 tileEnergyIdMap.end(), acd_row(row) );
00706         }
00707         ACD_tileTopCount = m_acd_tileCount[0];
00708         ACD_tileCount0 = m_acd_tileCount[1];
00709         ACD_tileCount1 = m_acd_tileCount[2];
00710         ACD_tileCount2 = m_acd_tileCount[3];       
00711         ACD_tileCount3 = m_acd_tileCount[4];  
00712 
00713     } else {
00714         return StatusCode::FAILURE;
00715         // -----------------------------------------
00716     */     
00717     }
00718 
00719 return sc;
00720 }

void AcdValsTool::findId const std::vector< Event::AcdTkrIntersection * >  vec,
idents::AcdId &  retId,
bool  findRibbon = false
 

Definition at line 770 of file AcdValsTool.cxx.

Referenced by setId().

00772 {
00773 
00774     //Point tilePos, ribbonPos;
00775     int tileIndex = -1, ribIndex = -1;
00776 
00777     //idents::AcdId tileId;  //, ribId;
00778     //tileI d.na(1);
00779     //ribId.na(1);
00780     retId.na(1);
00781     if (vec.size() <= 0) {
00782         //retId = tileId;
00783         return;
00784     }
00785 
00786     //if ( (!findRibbon) && (vec[0]->getTileId().tile()) {
00787     //    tileIndex = 0;
00788     //    tileId = vec[0]->getTileId();
00789     //} else {
00790     //    ribIndex = 0;
00791     //    ribId = vec[0]->getTileId();
00792     // }
00793 
00794     // If there is only one TkrIntesection object, then we can return the one id we have
00795     if (vec.size() == 1) {
00796         if ( (!findRibbon) && (vec[0]->getTileId().tile()) )
00797             retId = vec[0]->getTileId();
00798         else if ( (findRibbon) && (vec[0]->getTileId().ribbon()) ) 
00799             retId = vec[0]->getTileId();
00800         return;
00801     }
00802 
00803     // otherwise, loop over the remaining TkrIntesection objects
00804     unsigned int ind=0;
00805     Event::AcdTkrIntersectionCol::const_iterator itrTrackIntersect;
00806     itrTrackIntersect = vec.begin();
00807     for ( ; itrTrackIntersect != vec.end(); itrTrackIntersect++ ) {
00808         idents::AcdId id = (*itrTrackIntersect)->getTileId();
00809         if ( (!findRibbon) && (id.tile()) ) {
00810             if (tileIndex < 0) {  // haven't seen another tile yet
00811                 tileIndex = ind;
00812                 retId = id;
00813             } else { // there was another tile found already
00814                 // use Z coordinates to choose if one of the found tiles is a "top" tile
00815                 // chose the greater Z value
00816                 if ( (retId.top()) || (id.top()) ) {
00817                     if (vec[tileIndex]->getGlobalPosition().z() < (*itrTrackIntersect)->getGlobalPosition().z()) {
00818                         retId = (*itrTrackIntersect)->getTileId();
00819                         tileIndex = ind;
00820                     }
00821                 }   
00822                 // assume side tiles do not overlap in Gleam, so no worries 
00823                 // about handling that case now
00824                 // right now we just pick up the tile we find first
00825             }
00826         } else if (findRibbon && id.ribbon() ) { // ribbon
00827             if (ribIndex < 0) { // first ribbon intersection found
00828                 ribIndex = ind;
00829                 retId = id;
00830             } 
00831             // don't worry about overlapping ribbons, 
00832             // just pick up the first ribbon we find
00833         }
00834 
00835         ind++;
00836     }
00837 
00838 
00839     return;
00840 }

StatusCode AcdValsTool::initialize  )  [virtual]
 

Reimplemented from ValBase.

Definition at line 286 of file AcdValsTool.cxx.

References ACD_ActiveDist3D, ACD_ActiveDist3D_Err, ACD_ActiveDist_Energy, ACD_ActiveDist_TrackNum, ACD_Corner_DOCA, ACD_countRow3Readout, ACD_energyRow0, ACD_energyRow1, ACD_energyRow2, ACD_energyRow3, ACD_energyTop, ACD_ribbon_ActiveDist, ACD_ribbon_ActiveDist_Err, ACD_ribbon_ActiveLength, ACD_Ribbon_Count, ACD_ribbon_EnergyPmtA, ACD_ribbon_EnergyPmtB, ACD_RibbonIdRecon, ACD_Tile_Count, ACD_tileCount0, ACD_tileCount1, ACD_tileCount2, ACD_tileCount3, ACD_TileIdRecon, ACD_tileTopCount, ACD_Tkr1_ribbon_ActiveDist, ACD_Tkr1_ribbon_ActiveDist_Err, ACD_Tkr1_ribbon_ActiveLength, ACD_Tkr1_ribbon_EnergyPmtA, ACD_Tkr1_ribbon_EnergyPmtB, ACD_Tkr1ActiveDist, ACD_Tkr1ActiveDist_Energy, ACD_Tkr1ActiveDist_Err, ACD_Tkr1Corner_DOCA, ACD_Tkr1Hole_Dist, ACD_Tkr1Ribbon_Dist, ACD_Tkr1RibbonLength, ACD_TkrHole_Dist, ACD_TkrRibbon_Dist, ACD_TkrRibbonLength, ACD_Total_Energy, ACD_Total_Ribbon_Energy, ACD_VtxActiveDist, ACD_VtxActiveDist_Down, ACD_VtxActiveDist_Energy, ACD_VtxActiveDist_EnergyDown, ValBase::addItem(), ValBase::initialize(), m_detSvc, m_vetoThresholdMeV, and ValBase::zeroVals().

00287 {
00288     StatusCode sc = StatusCode::SUCCESS;
00289 
00290     MsgStream log(msgSvc(), name());
00291 
00292     if( ValBase::initialize().isFailure()) return StatusCode::FAILURE;
00293 
00294     setProperties();
00295     // get the services
00296 
00297     // use the pointer from ValBase
00298 
00299     if( serviceLocator() ) {
00300 
00301         // find GlastDevSvc service
00302         if (service("GlastDetSvc", m_detSvc, true).isFailure()){
00303             log << MSG::INFO << "Couldn't find the GlastDetSvc!" << endreq;
00304             log << MSG::INFO << "Will be unable to calculate ACD_TkrHitsCount" << endreq;
00305             m_vetoThresholdMeV = 0.4;
00306         } else {
00307             StatusCode sc = m_detSvc->getNumericConstByName("acd.vetoThreshold", 
00308                 &m_vetoThresholdMeV);
00309             if (sc.isFailure()) {
00310                 log << MSG::INFO << 
00311                     "Unable to retrieve threshold, setting the value to 0.4 MeV" << endreq;
00312                 m_vetoThresholdMeV = 0.4;
00313             }
00314         }
00315     } else {
00316         return StatusCode::FAILURE;
00317     }
00318 
00319     // load up the map
00320     addItem("AcdTileCount",    &ACD_Tile_Count);
00321     addItem("AcdRibbonCount", &ACD_Ribbon_Count);
00322     addItem("AcdTotalEnergy", &ACD_Total_Energy);
00323     addItem("AcdRibbonEnergy", &ACD_Total_Ribbon_Energy);
00324     addItem("AcdTileIdRecon", &ACD_TileIdRecon);
00325     addItem("AcdRibbonIdRecon", &ACD_RibbonIdRecon);
00326 
00327     addItem("AcdActiveDist3D",   &ACD_ActiveDist3D);
00328     addItem("AcdActiveDist3DErr",   &ACD_ActiveDist3D_Err);
00329     addItem("AcdActDistTileEnergy",   &ACD_ActiveDist_Energy);
00330     addItem("AcdActDistTrackNum", &ACD_ActiveDist_TrackNum);
00331 
00332     addItem("AcdRibbonActDist", &ACD_ribbon_ActiveDist);
00333     addItem("AcdRibbonActDistErr", &ACD_ribbon_ActiveDist_Err);
00334     addItem("AcdRibbonActLength", &ACD_ribbon_ActiveLength);
00335     addItem("AcdRibbonActEnergyPmtA", &ACD_ribbon_EnergyPmtA);
00336     addItem("AcdRibbonActEnergyPmtB", &ACD_ribbon_EnergyPmtB);
00337 
00338     addItem("AcdCornerDoca",    &ACD_Corner_DOCA);
00339     addItem("AcdTkrHoleDist",    &ACD_TkrHole_Dist);
00340     addItem("AcdTkrRibbonDist",    &ACD_TkrRibbon_Dist);
00341     addItem("AcdTkrRibbonLength",    &ACD_TkrRibbonLength);
00342 
00343     addItem("AcdTkr1ActiveDist", &ACD_Tkr1ActiveDist);
00344     addItem("AcdTkr1ActiveDistErr", &ACD_Tkr1ActiveDist_Err);
00345     addItem("AcdTkr1ActDistTileEnergy", &ACD_Tkr1ActiveDist_Energy);
00346 
00347     addItem("AcdTkr1RibbonActDist", &ACD_Tkr1_ribbon_ActiveDist);
00348     addItem("AcdTkr1RibbonActDistErr", &ACD_Tkr1_ribbon_ActiveDist_Err);
00349     addItem("AcdTkr1RibbonActLength", &ACD_Tkr1_ribbon_ActiveLength);
00350     addItem("AcdTkr1RibbonActEnergyPmtA", &ACD_Tkr1_ribbon_EnergyPmtA);
00351     addItem("AcdTkr1RibbonActEnergyPmtB", &ACD_Tkr1_ribbon_EnergyPmtB);
00352 
00353     addItem("AcdTkr1CornerDoca",    &ACD_Tkr1Corner_DOCA);
00354     addItem("AcdTkr1HoleDist",    &ACD_Tkr1Hole_Dist);
00355     addItem("AcdTkr1RibbonDist",    &ACD_Tkr1Ribbon_Dist);
00356     addItem("AcdTkr1RibbonLength",    &ACD_Tkr1RibbonLength);    
00357 
00358     addItem("AcdVtxActiveDist", &ACD_VtxActiveDist);
00359     addItem("AcdVtxActDistTileEnergy", &ACD_VtxActiveDist_Energy);
00360     addItem("AcdVtxActiveDist_Down", &ACD_VtxActiveDist_Down);
00361     addItem("AcdVtxActDistTileEnergy_Down", &ACD_VtxActiveDist_EnergyDown);
00362 
00363     addItem("AcdNoTop",        &ACD_tileTopCount);
00364     addItem("AcdNoSideRow0",   &ACD_tileCount0);
00365     addItem("AcdNoSideRow1",   &ACD_tileCount1);
00366     addItem("AcdNoSideRow2",   &ACD_tileCount2);   
00367     addItem("AcdNoSideRow3",   &ACD_tileCount3);
00368 
00369     addItem("AcdNoRow3Readout", &ACD_countRow3Readout);
00370     addItem("AcdEnergyTop",  & ACD_energyTop);
00371     addItem("AcdEnergyRow0", & ACD_energyRow0);
00372     addItem("AcdEnergyRow1", & ACD_energyRow1);
00373     addItem("AcdEnergyRow2", & ACD_energyRow2);
00374     addItem("AcdEnergyRow3", & ACD_energyRow3);
00375 
00376     zeroVals();
00377     ACD_ActiveDist_TrackNum = -1;
00378 
00379     return sc;
00380 }

void AcdValsTool::reconId const Event::AcdRecon *  pACD  ) 
 

Definition at line 723 of file AcdValsTool.cxx.

References ACD_RibbonIdRecon, ACD_TileIdRecon, and setId().

Referenced by calculate().

00724 {
00725     std::vector<Event::AcdTkrIntersection*> bestTrackUp, 
00726         bestTrackDown, vertexUp, vertexDown;
00727 
00728     Event::AcdTkrIntersectionCol::const_iterator itrTrackIntersect; 
00729 
00730     idents::AcdId resetId;
00731     resetId.na(1);
00732     ACD_TileIdRecon = resetId.id();
00733     ACD_RibbonIdRecon = resetId.id();
00734 
00735     // loop over the AcdTrackIntersections
00736     const Event::AcdTkrIntersectionCol& trackIntersectCol = 
00737         pACD->getAcdTkrIntersectionCol();
00738     itrTrackIntersect = trackIntersectCol.begin();
00739     for ( ; itrTrackIntersect != trackIntersectCol.end(); itrTrackIntersect++ ) {
00740 
00741         // could be vertex (-1) or best track (0)            
00742         if ((*itrTrackIntersect)->getTrackIndex() > 0 ) continue;
00743 
00744         double arcLen = (*itrTrackIntersect)->getArcLengthToIntersection();
00745 
00746         if (((*itrTrackIntersect)->getTrackIndex() == 0)){ // tracks
00747             if (arcLen > 0) // upward track
00748                 bestTrackUp.push_back(*itrTrackIntersect);
00749             else  // downward track
00750                 bestTrackDown.push_back(*itrTrackIntersect);
00751         } else if ( ((*itrTrackIntersect)->getTrackIndex() == -1)) { // vertices 
00752             if (arcLen > 0)
00753                 vertexUp.push_back(*itrTrackIntersect);
00754             else 
00755                 vertexDown.push_back(*itrTrackIntersect);
00756         }
00757     }
00758 
00759 
00760     setId(vertexUp, vertexDown, bestTrackUp, bestTrackDown, ACD_TileIdRecon, false);
00761     setId(vertexUp, vertexDown, bestTrackUp, bestTrackDown, ACD_RibbonIdRecon, true);
00762 
00763     bestTrackUp.clear();
00764     bestTrackDown.clear();
00765     vertexUp.clear();
00766     vertexDown.clear();
00767 }

void AcdValsTool::setId const std::vector< Event::AcdTkrIntersection * >  vertexUp,
const std::vector< Event::AcdTkrIntersection * >  vertexDown,
const std::vector< Event::AcdTkrIntersection * >  trackUp,
const std::vector< Event::AcdTkrIntersection * >  trackDown,
unsigned int &  retId,
bool  findRibbon = false
 

Definition at line 842 of file AcdValsTool.cxx.

References findId().

Referenced by reconId().

00847 {
00848 
00849     idents::AcdId vUpId, vDownId, tUpId, tDownId;
00850     vUpId.na(1);
00851     vDownId.na(1);
00852     tUpId.na(1);
00853     tDownId.na(1);
00854 
00855     findId(vertexUp, vUpId, findRibbon);
00856     findId(vertexDown, vDownId, findRibbon);
00857     findId(bestTrackUp, tUpId, findRibbon);
00858     findId(bestTrackDown, tDownId, findRibbon);
00859 
00860     // Prefer vertices over tracks
00861     // up versus down
00862     bool found = false;
00863     if (!vUpId.na()) {
00864         retId = vUpId.id();
00865         found = true;
00866     } else if (!tUpId.na()) { 
00867         retId = tUpId.id();
00868         found = true;
00869     }
00870 
00871     // no upward intersections found - check downward
00872     if (!found) {
00873         if (!vDownId.na()) 
00874             retId = vDownId.id();
00875         else if (!tDownId.na()) 
00876             retId = tDownId.id();
00877     }
00878 }

void AcdValsTool::tkrHitsCount  ) 
 


Member Data Documentation

float AcdValsTool::ACD_ActiveDist3D [private]
 

Definition at line 85 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_ActiveDist3D_Err [private]
 

Definition at line 86 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_ActiveDist_Energy [private]
 

Definition at line 87 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

int AcdValsTool::ACD_ActiveDist_TrackNum [private]
 

Definition at line 82 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Corner_DOCA [private]
 

Definition at line 98 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

unsigned int AcdValsTool::ACD_countRow3Readout [private]
 

Definition at line 134 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_energyRow0 [private]
 

Definition at line 137 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_energyRow1 [private]
 

Definition at line 138 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_energyRow2 [private]
 

Definition at line 139 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_energyRow3 [private]
 

Definition at line 140 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_energyTop [private]
 

Definition at line 136 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_ribbon_ActiveDist [private]
 

Definition at line 91 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_ribbon_ActiveDist_Err [private]
 

Definition at line 92 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_ribbon_ActiveLength [private]
 

Definition at line 93 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

unsigned int AcdValsTool::ACD_Ribbon_Count [private]
 

Definition at line 77 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_ribbon_EnergyPmtA [private]
 

Definition at line 94 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_ribbon_EnergyPmtB [private]
 

Definition at line 95 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

unsigned int AcdValsTool::ACD_RibbonIdRecon [private]
 

Definition at line 81 of file AcdValsTool.cxx.

Referenced by initialize(), and reconId().

unsigned int AcdValsTool::ACD_Tile_Count [private]
 

Definition at line 76 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

unsigned int AcdValsTool::ACD_tileCount0 [private]
 

Definition at line 129 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

unsigned int AcdValsTool::ACD_tileCount1 [private]
 

Definition at line 130 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

unsigned int AcdValsTool::ACD_tileCount2 [private]
 

Definition at line 131 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

unsigned int AcdValsTool::ACD_tileCount3 [private]
 

Definition at line 132 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

unsigned int AcdValsTool::ACD_TileIdRecon [private]
 

Definition at line 80 of file AcdValsTool.cxx.

Referenced by initialize(), and reconId().

unsigned int AcdValsTool::ACD_tileTopCount [private]
 

Definition at line 128 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Tkr1_ribbon_ActiveDist [private]
 

Definition at line 109 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Tkr1_ribbon_ActiveDist_Err [private]
 

Definition at line 110 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Tkr1_ribbon_ActiveLength [private]
 

Definition at line 111 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Tkr1_ribbon_EnergyPmtA [private]
 

Definition at line 112 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Tkr1_ribbon_EnergyPmtB [private]
 

Definition at line 113 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Tkr1ActiveDist [private]
 

Definition at line 104 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Tkr1ActiveDist_Energy [private]
 

Definition at line 106 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Tkr1ActiveDist_Err [private]
 

Definition at line 105 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Tkr1Corner_DOCA [private]
 

Definition at line 116 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Tkr1Hole_Dist [private]
 

Definition at line 117 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Tkr1Ribbon_Dist [private]
 

Definition at line 118 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Tkr1RibbonLength [private]
 

Definition at line 119 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_TkrHole_Dist [private]
 

Definition at line 99 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_TkrRibbon_Dist [private]
 

Definition at line 100 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_TkrRibbonLength [private]
 

Definition at line 101 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Total_Energy [private]
 

Definition at line 78 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_Total_Ribbon_Energy [private]
 

Definition at line 79 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_VtxActiveDist [private]
 

Definition at line 122 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_VtxActiveDist_Down [private]
 

Definition at line 124 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_VtxActiveDist_Energy [private]
 

Definition at line 123 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

float AcdValsTool::ACD_VtxActiveDist_EnergyDown [private]
 

Definition at line 125 of file AcdValsTool.cxx.

Referenced by calculate(), and initialize().

IGlastDetSvc* AcdValsTool::m_detSvc [private]
 

Definition at line 143 of file AcdValsTool.cxx.

Referenced by initialize().

double AcdValsTool::m_vetoThresholdMeV [private]
 

Definition at line 146 of file AcdValsTool.cxx.

Referenced by AcdValsTool(), and initialize().


The documentation for this class was generated from the following file:
Generated on Wed Nov 26 14:03:24 2008 by doxygen 1.3.3