/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Validation/FarmMonitorAlg/FarmMonitorAlg-00-00-03/src/FarmMonitorAlg.cxx

Go to the documentation of this file.
00001 #include "GaudiKernel/MsgStream.h"
00002 #include "GaudiKernel/AlgFactory.h"
00003 #include "GaudiKernel/SmartDataPtr.h"
00004 #include "GaudiKernel/IDataProviderSvc.h"
00005 #include "GaudiKernel/PropertyMgr.h"
00006 
00007 #include "EventModel/EventModel.h"
00008 #include "EventModel/Event.h"
00009 #include "EventModel/EventHeader.h"
00010 #include "EvtRecEvent/EvtRecEvent.h"
00011 #include "EvtRecEvent/EvtRecTrack.h"
00012 #include "EvtRecEvent/EvtRecVeeVertex.h"
00013 
00014 #include "TMath.h"
00015 #include "GaudiKernel/INTupleSvc.h"
00016 #include "GaudiKernel/NTuple.h"
00017 #include "GaudiKernel/Bootstrap.h"
00018 #include "GaudiKernel/IHistogramSvc.h"
00019 
00020 #include "DstEvent/TofHitStatus.h"
00021 
00022 #include "CLHEP/Vector/ThreeVector.h"
00023 #include "CLHEP/Vector/LorentzVector.h"
00024 
00025 #include "FarmMonitorAlg/FarmMonitorAlg.h"
00026 
00027 using namespace std;
00028 using namespace Event;
00029 
00030 double mPi     = 0.13957;
00031 double mKs     = 0.49767;
00032 double mLambda = 1.11568;
00033 
00034 
00036 
00037 FarmMonitorAlg::FarmMonitorAlg(const std::string& name, ISvcLocator* pSvcLocator) :
00038   Algorithm(name, pSvcLocator) {
00039   
00040   //Declare the properties  
00041   declareProperty("PrintRunEventFreq", m_RunEventFreq = 10);
00042 
00043   declareProperty("Ecm", m_ecm = 3.686);
00044   declareProperty("Vr0cut", m_vr0cut = 1.0);
00045   declareProperty("Vz0cut", m_vz0cut = 5.0);
00046 
00047 }
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
00050 StatusCode FarmMonitorAlg::initialize(){
00051   MsgStream log(msgSvc(), name());
00052 
00053   log << MSG::INFO << "in initialize()" << endmsg;
00054   
00055   StatusCode status;
00056 
00057   //histograms
00058 
00060   h_eVisibleDivEcm = histoSvc()->book("eVisibleDivEcm", 1, "eVisible/Ecm", 150, 0.0, 1.5);
00061   h_eEMCDivEcm     = histoSvc()->book("eEMCDivEcm",     1, "eEMC/Ecm",     150, 0.0, 1.5);
00062   h_eNeutralDivEcm = histoSvc()->book("eNeutralDivEcm", 1, "eNeutral/Ecm", 150, 0.0, 1.5);
00063   h_eChargedDivEcm = histoSvc()->book("eChargedDivEcm", 1, "eCharged/Ecm", 150, 0.0, 1.5);
00064 
00066   h_netMomentumDivEcm_AllChargedTracks = histoSvc()->book("netMomentumDivEcm_AllChargedTracks", 
00067                                                           1, "#Sigma p/Ecm (Charged)", 100, 0.0, 1.0);
00068   h_netTransMomentumDivEcm_AllChargedTracks = histoSvc()->book("netTransMomentumDivEcm_AllChargedTracks",
00069                                                           1, "#Sigma ptr/Ecm (Charged)", 100, 0.0, 1.0);
00070   h_cosTheta_AllChargedTracks = histoSvc()->book("cosTheta_AllChargedTracks",
00071                                                           1, "cos#theta (Charged)", 100, -1.0, 1.0);
00072 
00073   h_netMomentumDivEcm_AllNeutralTracks = histoSvc()->book("netMomentumDivEcm_AllNeutralTracks", 
00074                                                           1, "#Sigma p/Ecm (Neutral)", 100, 0.0, 1.0);
00075   h_netTransMomentumDivEcm_AllNeutralTracks = histoSvc()->book("netTransMomentumDivEcm_AllNeutralTracks",
00076                                                           1, "#Sigma ptr/Ecm (Neutral)", 100, 0.0, 1.0);
00077   h_cosTheta_AllNeutralTracks = histoSvc()->book("cosTheta_AllNeutralTracks",
00078                                                           1, "cos#theta (Neutral)", 100, -1.0, 1.0);
00079 
00080   h_netMomentumDivEcm_AllTracks = histoSvc()->book("netMomentumDivEcm_AllTracks", 
00081                                                           1, "#Sigma p/Ecm", 100, 0.0, 1.0);
00082   h_netTransMomentumDivEcm_AllTracks = histoSvc()->book("netTransMomentumDivEcm_AllTracks",
00083                                                           1, "#Sigma ptr/Ecm", 100, 0.0, 1.0);
00084   h_cosTheta_AllTracks = histoSvc()->book("cosTheta_AllTracks",
00085                                                           1, "cos#theta", 100, -1.0, 1.0);
00086 
00088   h_trackR0 = histoSvc()->book("trackR0", 1, "R0 (cm)", 100, 0.0, 2.0);
00089   h_trackZ0 = histoSvc()->book("trackZ0", 1, "Z0 (cm)", 100, -20.0, 20.0);
00090 
00091   h_nChargedTracks   = histoSvc()->book("nChargedTracks",   1, "NChargedTracks", 17, -0.5, 16.5);
00092   h_nChargedTracksIP = histoSvc()->book("nChargedTracksIP", 1, "NChargedTracks from IP", 17, -0.5, 16.5);
00093 
00094   h_netCharge   = histoSvc()->book("netCharge",   1, "Net Charge", 11, -5.5, 5.5);
00095   h_netChargeIP = histoSvc()->book("netChargeIP", 1, "Net Charge with IP tracks", 11, -5.5, 5.5);
00096 
00098   h_pIPTrack1DivEb = histoSvc()->book("pIPTrack1DivEb", 1, "pTrack1/Ebeam", 150, 0.0, 1.5);
00099   h_pIPTrack2DivEb = histoSvc()->book("pIPTrack2DivEb", 1, "pTrack2/Ebeam", 150, 0.0, 1.5);
00100 
00101   h_eEMCIPTrack1DivEb = histoSvc()->book("eEMCIPTrack1DivEb", 1, "eEMCTrack1/Ebeam", 150, 0.0, 1.5);
00102   h_eEMCIPTrack2DivEb = histoSvc()->book("eEMCIPTrack2DivEb", 1, "eEMCTrack2/Ebeam", 150, 0.0, 1.5);
00103 
00104   h_acoplanarity_2HighestPIPTracks = histoSvc()->book("acoplanarity_2HighestPIPTracks", 
00105                                                     1, "acoplanarity", 158, 0.0, 3.16);
00106 
00108   h_nNeutralTracks         = histoSvc()->book("nNeutralTracks",         1, "NNeutralTracks", 31, -0.5, 30.5);
00109   h_nNeutralTracksGT30MeV  = histoSvc()->book("nNeutralTracksGT30MeV",  1, "NNeutralTracksGT30MeV", 31, -0.5, 30.5);
00110 
00111   h_eEMCShower1DivEb = histoSvc()->book("eEMCShower1DivEb", 1, "eEMCShower1/Ebeam", 150, 0.0, 1.5);
00112   h_eEMCShower2DivEb = histoSvc()->book("eEMCShower2DivEb", 1, "eEMCShower2/Ebeam", 150, 0.0, 1.5);
00113   h_eEMCShower3DivEb = histoSvc()->book("eEMCShower3DivEb", 1, "eEMCShower3/Ebeam", 150, 0.0, 1.5);
00114 
00115 
00117   h_mucDepth = histoSvc()->book("mucDepth", 1, "mucDepth", 200, 0.0, 200.0);
00118   h_mucDepthVsCosTheta = histoSvc()->book("mucDepthVsCosTheta", 2, "mucDepthVsCosTheta", 
00119                                           100, -1.0, 1.0, 200, 0.0, 200.0);
00120   h_mucDepthVsPhi = histoSvc()->book("mucDepthVsPhi", 2, "mucDepthVsPhi", 
00121                                      180, -3.15, 3.15, 200, 0.0, 200.0);
00122 
00124   h_dedxTotalHitsIP = histoSvc()->book("dedxTotalHitsIP", 1, "dedxTotalHitsIP", 70, 0.0, 70.0);
00125   h_dedxGoodHitsIP  = histoSvc()->book("dedxGoodHitsIP",  1, "dedxGoodHitsIP", 70, 0.0, 70.0);
00126   h_dedxElecChiIP   = histoSvc()->book("dedxElecChiIP",   1, "dedxElecChiIP", 120, -6.0, 6.0);
00127   h_dedxMuonChiIP   = histoSvc()->book("dedxMuonChiIP",   1, "dedxMuonChiIP", 120, -6.0, 6.0);
00128   h_dedxPionChiIP   = histoSvc()->book("dedxPionChiIP",   1, "dedxPionChiIP", 120, -6.0, 6.0);
00129   h_dedxKaonChiIP   = histoSvc()->book("dedxKaonChiIP",   1, "dedxKaonChiIP", 120, -6.0, 6.0);
00130   h_dedxProtonChiIP = histoSvc()->book("dedxProtonChiIP", 1, "dedxProtonChiIP", 120, -6.0, 6.0);
00131   h_dedxProbPHIP = histoSvc()->book("dedxProbPHIP", 1, "dedxProbPHIP", 200, 0.0, 2000.0);
00132   h_dedxProbPHVsMomentumIP = histoSvc()->book("dedxProbPHVsMomentumIP", 2, "dedxProbPHVsMomentumIP", 
00133                                      100, 0.0, 2.0, 200, 0.0, 2000.0);
00134 
00136   h_tofPHIP_BarrelLayer1 = histoSvc()->book("tofPHIP_BarrelLayer1", 1, "tofPHIP_BarrelLayer1", 250, 0.0, 5000.0);
00137   h_tofPHIP_BarrelLayer2 = histoSvc()->book("tofPHIP_BarrelLayer2", 1, "tofPHIP_BarrelLayer2", 250, 0.0, 5000.0);
00138   h_tofPHIP_EastEndcap = histoSvc()->book("tofPHIP_EastEndcap", 1, "tofPHIP_EastEndcap", 200, 0.0, 4000.0);
00139   h_tofPHIP_WestEndcap = histoSvc()->book("tofPHIP_WestEndcap", 1, "tofPHIP_WestEndcap", 200, 0.0, 4000.0);
00140   h_tofIP_BarrelLayer1 = histoSvc()->book("tofIP_BarrelLayer1", 1, "tofIP_BarrelLayer1", 100, 0.0, 20.0);
00141   h_tofIP_BarrelLayer2 = histoSvc()->book("tofIP_BarrelLayer2", 1, "tofIP_BarrelLayer1", 100, 0.0, 20.0);
00142   h_tofIP_EastEndcap = histoSvc()->book("tofIP_EastEndcap", 1, "tofIP_EastEndcap", 100, 0.0, 20.0);
00143   h_tofIP_WestEndcap = histoSvc()->book("tofIP_WestEndcap", 1, "tofIP_WestEndcap", 100, 0.0, 20.0);
00144   h_tofElecIP_Barrel   = histoSvc()->book("tofElecIP_Barrel",   1, "tofElecIP_Barrel", 120, -6.0, 6.0);
00145   h_tofMuonIP_Barrel   = histoSvc()->book("tofMuonIP_Barrel",   1, "tofMuonIP_Barrel", 120, -6.0, 6.0);
00146   h_tofPionIP_Barrel   = histoSvc()->book("tofPionIP_Barrel",   1, "tofPionIP_Barrel", 120, -6.0, 6.0);
00147   h_tofKaonIP_Barrel   = histoSvc()->book("tofKaonIP_Barrel",   1, "tofKaonIP_Barrel", 120, -6.0, 6.0);
00148   h_tofProtonIP_Barrel = histoSvc()->book("tofProtonIP_Barrel", 1, "tofProtonIP_Barrel", 120, -6.0, 6.0);
00149   h_tofElecIP_Endcap   = histoSvc()->book("tofElecIP_Endcap",   1, "tofElecIP_Endcap", 120, -6.0, 6.0);
00150   h_tofMuonIP_Endcap   = histoSvc()->book("tofMuonIP_Endcap",   1, "tofMuonIP_Endcap", 120, -6.0, 6.0);
00151   h_tofPionIP_Endcap   = histoSvc()->book("tofPionIP_Endcap",   1, "tofPionIP_Endcap", 120, -6.0, 6.0);
00152   h_tofKaonIP_Endcap   = histoSvc()->book("tofKaonIP_Endcap",   1, "tofKaonIP_Endcap", 120, -6.0, 6.0);
00153   h_tofProtonIP_Endcap = histoSvc()->book("tofProtonIP_Endcap", 1, "tofProtonIP_Endcap", 120, -6.0, 6.0);
00154   h_tofVsMomentumIP = histoSvc()->book("tofVsMomentumIP", 2, "tofVsMomentumIP", 
00155                                        100, 0.0, 2.0, 100, 0.0, 20.0);
00156 
00158   h_nKs = histoSvc()->book("nKs",       1,    "nKs",  9, -0.5,   8.5);
00159   h_ksMass = histoSvc()->book("ksMass", 1, "ksMass", 70, 0.480, 0.515);
00160 
00161   h_nLambda = histoSvc()->book("nLambda",       1,    "nLambda",  9, -0.5,   8.5);
00162   h_lambdaMass = histoSvc()->book("lambdaMass", 1, "lambdaMass", 76, 1.100, 1.133);
00163 
00164   // Add Pi0 histograms when official pi0 list is ready
00165 
00166 
00167   log << MSG::INFO << "successfully return from initialize()" <<endmsg;
00168   return StatusCode::SUCCESS;
00169 
00170 }
00171 
00172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
00173 StatusCode FarmMonitorAlg::execute() {
00174   
00175   double eBeam = m_ecm/2;
00176 
00177   MsgStream log(msgSvc(), name());
00178   log << MSG::INFO << "in execute()" << endreq;
00179 
00180   SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
00181   int run=eventHeader->runNumber();
00182   int event=eventHeader->eventNumber();
00183   if( event%m_RunEventFreq == 0)  std::cout << "Run " << run << ", event " << event << std::endl;
00184 
00185   SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
00186     log << MSG::DEBUG <<"ncharg, nneu, tottks = " 
00187       << evtRecEvent->totalCharged() << " , "
00188       << evtRecEvent->totalNeutral() << " , "
00189       << evtRecEvent->totalTracks() <<endreq;
00190 
00191   SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(),  EventModel::EvtRec::EvtRecTrackCol);
00192 
00193 
00196   int nChargedTracks = 0, nChargedTracksIP = 0;
00197   int nCharge = 0, nChargeIP = 0;
00198   double totalVisibleEnergy = 0, totalChargedEnergy = 0, totalEMCEnergy = 0;
00199   double totalChargedPX = 0, totalChargedPY = 0, totalChargedPZ = 0; 
00200 
00201   double highestIPTrackP = -1, secondHighestIPTrackP = -2;
00202   int highestPIPTrackId = -1, secondHighestPIPTrackId = -1;
00203 
00205   for(int i = 0; i < evtRecEvent->totalCharged(); i++){
00206     EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + i;
00207     if(!(*itTrk)->isMdcTrackValid()) continue;
00208     RecMdcTrack *mdcTrk = (*itTrk)->mdcTrack();
00209 
00210     int trackId = mdcTrk->trackId();
00211     int charge = mdcTrk->charge();
00212     double r0 = mdcTrk->r();
00213     double z0 = mdcTrk->z();
00214     h_trackR0->fill(r0);
00215     h_trackZ0->fill(z0);
00216 
00217     nChargedTracks++;
00218     nCharge += charge;
00219 
00220     double pX = mdcTrk->px();
00221     double pY = mdcTrk->py();
00222     double pZ = mdcTrk->pz();
00223     double pMag = mdcTrk->p();
00224     double cosTheta = cos(mdcTrk->theta());
00225     double phi = mdcTrk->phi();
00226 
00227     double chargedEnergy = sqrt(pMag*pMag + mPi*mPi);
00228     totalVisibleEnergy += chargedEnergy;
00229     totalChargedEnergy += chargedEnergy;
00230 
00231     totalChargedPX += pX;    
00232     totalChargedPY += pY;    
00233     totalChargedPZ += pZ;    
00234 
00236     if( (*itTrk)->isEmcShowerValid() ) {
00237       RecEmcShower* emcChargedTrk = (*itTrk)->emcShower();
00238       totalEMCEnergy += emcChargedTrk->energy();
00239     }
00240 
00242     if( (*itTrk)->isMucTrackValid() ) {
00243       RecMucTrack* mucTrk = (*itTrk)->mucTrack();
00244       double mucDepth = mucTrk->depth();
00245       if(mucDepth > 0) {
00246         h_mucDepth->fill(mucDepth);
00247         h_mucDepthVsCosTheta->fill(cosTheta,mucDepth);
00248         h_mucDepthVsPhi->fill(phi,mucDepth);
00249       }
00250     }  // End of "isMucShowerValid()" IF
00251 
00252 
00255     if(fabs(z0) >= m_vz0cut) continue;
00256     if(r0 >= m_vr0cut) continue;
00257 
00258     nChargedTracksIP++;
00259     nChargeIP += charge;
00260 
00262     double dedxProbPH = -10;
00263     int dedxNumTotalHits = -10;
00264     int dedxNumGoodHits = -10;
00265 
00266     if( (*itTrk)->isMdcDedxValid() ) {
00267       RecMdcDedx* dedxTrk = (*itTrk)->mdcDedx();
00268 
00269       dedxNumTotalHits = dedxTrk->numTotalHits();
00270       dedxNumGoodHits = dedxTrk->numGoodHits();
00271       h_dedxTotalHitsIP->fill(dedxNumTotalHits);
00272       h_dedxGoodHitsIP->fill(dedxNumGoodHits);
00273 
00274       h_dedxElecChiIP->fill(dedxTrk->chiE());
00275       h_dedxMuonChiIP->fill(dedxTrk->chiMu());
00276       h_dedxPionChiIP->fill(dedxTrk->chiPi());
00277       h_dedxKaonChiIP->fill(dedxTrk->chiK());
00278       h_dedxProtonChiIP->fill(dedxTrk->chiP());
00279 
00280       dedxProbPH = dedxTrk->probPH();
00281       h_dedxProbPHIP->fill(dedxProbPH);
00282       h_dedxProbPHVsMomentumIP->fill(pMag,dedxProbPH);
00283       
00284     }  // End of "isMdcDedxValid()" IF
00285  
00287     if( (*itTrk)->isTofTrackValid() ) {
00288       SmartRefVector<RecTofTrack> tofTrkCol = (*itTrk)->tofTrack();
00289       SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
00290 
00291       for(;iter_tof != tofTrkCol.end(); iter_tof++ ) {
00292         TofHitStatus *status = new TofHitStatus;
00293         status->setStatus((*iter_tof)->status());
00294 
00295         if( status->is_barrel() ) {
00296           if( !(status->is_counter()) ) continue; // ?
00297 
00298           double tofPH = (*iter_tof)->ph();
00299           double tof = (*iter_tof)->tof();
00300 
00301           h_tofElecIP_Barrel->fill(tof - (*iter_tof)->texpElectron());
00302           h_tofMuonIP_Barrel->fill(tof - (*iter_tof)->texpMuon());
00303           h_tofPionIP_Barrel->fill(tof - (*iter_tof)->texpPion());
00304           h_tofKaonIP_Barrel->fill(tof - (*iter_tof)->texpKaon());
00305           h_tofProtonIP_Barrel->fill(tof - (*iter_tof)->texpProton());
00306           h_tofVsMomentumIP->fill(pMag,tof);
00307           
00308           if( status->layer() == 1 ) {
00309             h_tofPHIP_BarrelLayer1->fill(tofPH);
00310             h_tofIP_BarrelLayer1->fill(tof);
00311           }
00312           if( status->layer() == 2 ) {
00313             h_tofPHIP_BarrelLayer2->fill(tofPH);
00314             h_tofIP_BarrelLayer2->fill(tof);
00315           }
00316         }  // End of TOF barrel IF
00317 
00318         else {
00319           if( !(status->is_counter()) ) continue; // ?
00320 
00321           double tofPH = (*iter_tof)->ph();
00322           double tof = (*iter_tof)->tof();
00323 
00324           h_tofElecIP_Endcap->fill(tof - (*iter_tof)->texpElectron());
00325           h_tofMuonIP_Endcap->fill(tof - (*iter_tof)->texpMuon());
00326           h_tofPionIP_Endcap->fill(tof - (*iter_tof)->texpPion());
00327           h_tofKaonIP_Endcap->fill(tof - (*iter_tof)->texpKaon());
00328           h_tofProtonIP_Endcap->fill(tof - (*iter_tof)->texpProton());
00329           h_tofVsMomentumIP->fill(pMag,tof);
00330           
00331           if( status->is_east() ) {
00332             h_tofPHIP_EastEndcap->fill(tofPH);
00333             h_tofIP_EastEndcap->fill(tof);
00334           }
00335           else {
00336             h_tofPHIP_WestEndcap->fill(tofPH);
00337             h_tofIP_WestEndcap->fill(tof);
00338           }
00339         }  // End of TOF endcap IF
00340 
00341       }  // End of "iter_tof" FOR
00342     }  // End of "isTofTrackValid()" IF
00343 
00344 
00346     if(pMag > highestIPTrackP) { 
00347       secondHighestPIPTrackId = highestPIPTrackId;
00348       secondHighestIPTrackP = highestIPTrackP;
00349       highestPIPTrackId = trackId;
00350       highestIPTrackP = pMag;
00351     }
00352     if((pMag > secondHighestIPTrackP)&&(pMag < highestIPTrackP)) { 
00353       secondHighestPIPTrackId = trackId;
00354       secondHighestIPTrackP = pMag;
00355     }
00356 
00357   }  // End of charged track FOR
00358 
00359 
00362   if(nChargedTracksIP > 0) {
00363       EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + highestPIPTrackId;
00364       RecMdcTrack *mdcTrk = (*itTrk)->mdcTrack();
00365       double highestPPhi0 = mdcTrk->phi();
00366       h_pIPTrack1DivEb->fill(mdcTrk->p()/eBeam);
00367 
00368       if( (*itTrk)->isEmcShowerValid() ) {
00369         RecEmcShower* emcChargedTrk = (*itTrk)->emcShower();
00370         h_eEMCIPTrack1DivEb->fill(emcChargedTrk->energy()/eBeam);
00371       }
00372 
00374       if(nChargedTracksIP > 1) {
00375         itTrk = evtRecTrkCol->begin() + secondHighestPIPTrackId;
00376         RecMdcTrack *mdcTrk = (*itTrk)->mdcTrack();
00377         double secondHighestPPhi0 = mdcTrk->phi();
00378         h_pIPTrack2DivEb->fill(mdcTrk->p()/eBeam);
00379 
00380         if( (*itTrk)->isEmcShowerValid() ) {
00381           RecEmcShower* emcChargedTrk = (*itTrk)->emcShower();
00382           h_eEMCIPTrack2DivEb->fill(emcChargedTrk->energy()/eBeam);
00383         }
00384 
00385         h_acoplanarity_2HighestPIPTracks->fill(fabs(CLHEP::pi - fabs(highestPPhi0 - secondHighestPPhi0)));      
00386    }  // End of "nChargedTracksIP > 1" IF
00387   }  // End of "nChargedTracksIP > 0" IF
00388   
00389 
00392   int nNeutralTracks = 0, nNeutralTracksGT30MeV = 0;
00393   double totalNeutralEnergy = 0;
00394   double totalNeutralPX = 0, totalNeutralPY = 0, totalNeutralPZ = 0; 
00395 
00396   for(int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) {
00397     EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
00398     if(!(*itTrk)->isEmcShowerValid()) continue;
00399     RecEmcShower *emcTrk = (*itTrk)->emcShower();
00400 
00401     nNeutralTracks++;
00402     double eraw = emcTrk->energy();
00403     if(eraw > 0.030) nNeutralTracksGT30MeV++;
00404 
00405     totalVisibleEnergy += eraw;
00406     totalEMCEnergy += eraw;
00407     totalNeutralEnergy += eraw;
00408 
00409     double theta = emcTrk->theta();
00410     double phi = emcTrk->phi();
00411     
00412     double pX = eraw*cos(phi)*sin(theta);
00413     double pY = eraw*sin(phi)*sin(theta);
00414     double pZ = eraw*cos(theta);
00415     
00416     totalNeutralPX += pX;    
00417     totalNeutralPY += pY;    
00418     totalNeutralPZ += pZ;    
00419 
00421     if(nNeutralTracks == 1) h_eEMCShower1DivEb->fill(eraw/eBeam);
00422     if(nNeutralTracks == 2) h_eEMCShower2DivEb->fill(eraw/eBeam);
00423     if(nNeutralTracks == 3) h_eEMCShower3DivEb->fill(eraw/eBeam);
00424 
00425   } // End of neutral track FOR
00426 
00427 
00430 
00431   h_nChargedTracks->fill(nChargedTracks);
00432   h_nChargedTracksIP->fill(nChargedTracksIP);
00433 
00434   h_netCharge->fill(nCharge);
00435   h_netChargeIP->fill(nChargeIP);
00436 
00437   h_nNeutralTracks->fill(nNeutralTracks);
00438   h_nNeutralTracksGT30MeV->fill(nNeutralTracksGT30MeV);
00439 
00440 
00442   h_eVisibleDivEcm->fill(totalVisibleEnergy/m_ecm);
00443   h_eEMCDivEcm->fill(totalEMCEnergy/m_ecm);     
00444   h_eNeutralDivEcm ->fill(totalNeutralEnergy/m_ecm);
00445   h_eChargedDivEcm->fill(totalChargedEnergy/m_ecm);
00446 
00447 
00449   double totalChargedPXY = sqrt(totalChargedPX*totalChargedPX + totalChargedPY*totalChargedPY);
00450   double totalChargedP = sqrt(totalChargedPXY*totalChargedPXY + totalChargedPZ*totalChargedPZ);
00451 
00452   h_netMomentumDivEcm_AllChargedTracks->fill(totalChargedP/m_ecm);
00453   h_netTransMomentumDivEcm_AllChargedTracks->fill(totalChargedPXY/m_ecm);
00454   if(totalChargedP > 0) {
00455     h_cosTheta_AllChargedTracks->fill(totalChargedPZ/totalChargedP);
00456   } else { 
00457     if(nChargedTracks > 0) {
00458     log << MSG::INFO << "Run " << run << ", event " << event 
00459         << ": totalChargedP <= 0! " << endmsg;
00460     }
00461   }
00462 
00463 
00465   double totalNeutralPXY = sqrt(totalNeutralPX*totalNeutralPX + totalNeutralPY*totalNeutralPY);
00466   double totalNeutralP = sqrt(totalNeutralPXY*totalNeutralPXY + totalNeutralPZ*totalNeutralPZ);
00467 
00468   h_netMomentumDivEcm_AllNeutralTracks->fill(totalNeutralP/m_ecm);
00469   h_netTransMomentumDivEcm_AllNeutralTracks->fill(totalNeutralPXY/m_ecm);
00470   if(totalNeutralP > 0) {
00471     h_cosTheta_AllNeutralTracks->fill(totalNeutralPZ/totalNeutralP);
00472   } else { 
00473     if(nNeutralTracks > 0) {
00474     log << MSG::INFO << "Run " << run << ", event " << event 
00475         << ": totalNeutralP <= 0! " << endmsg;
00476     }
00477   }
00478 
00480   double totalEventPX = totalChargedPX + totalNeutralPX;
00481   double totalEventPY = totalChargedPY + totalNeutralPY;
00482   double totalEventPZ = totalChargedPZ + totalNeutralPZ;
00483 
00484   double totalEventPXY = sqrt(totalEventPX*totalEventPX + totalEventPY*totalEventPY);
00485   double totalEventP = sqrt(totalEventPXY*totalEventPXY + totalEventPZ*totalEventPZ);
00486 
00487   h_netMomentumDivEcm_AllTracks->fill(totalEventP/m_ecm);
00488   h_netTransMomentumDivEcm_AllTracks->fill(totalEventPXY/m_ecm);
00489   if(totalEventP > 0) {
00490     h_cosTheta_AllTracks->fill(totalEventPZ/totalEventP);
00491   } else { 
00492     log << MSG::INFO << "Run " << run << ", event " << event 
00493         << ": totalEventP <= 0! " << endmsg;
00494   }
00495 
00496   
00498   SmartDataPtr<EvtRecVeeVertexCol> evtRecVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
00499   if ( ! evtRecVeeVertexCol ) {
00500     log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
00501     return StatusCode::FAILURE;
00502   }
00503 
00505   int numKs = 0, numLambda = 0;
00506   for(EvtRecVeeVertexCol::iterator veeItr = evtRecVeeVertexCol->begin(); 
00507       veeItr < evtRecVeeVertexCol->end(); veeItr++){
00508      
00509     h_ksMass->fill((*veeItr)->mass()); 
00510     if(fabs((*veeItr)->mass() - mKs) < 0.010)  ++numKs;
00511 
00512     h_lambdaMass->fill((*veeItr)->mass()); 
00513     if(fabs((*veeItr)->mass() - mLambda) < 0.010)  ++numLambda;
00514 
00515   }  // End of "evtRecVeeVertexCol" FOR
00516 
00517   h_nKs->fill(numKs); 
00518   h_nLambda->fill(numLambda); 
00519   
00520 
00521   return StatusCode::SUCCESS;
00522 }
00523 
00524 
00525 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
00526 StatusCode FarmMonitorAlg::finalize() {
00527 
00528   MsgStream log(msgSvc(), name());
00529   log << MSG::INFO << "in finalize()" << endmsg;
00530 
00531   return StatusCode::SUCCESS;
00532 }
00533 

Generated on Tue Nov 29 23:14:45 2016 for BOSS_7.0.2 by  doxygen 1.4.7