McCor Class Reference

#include <McCor.h>

List of all members.

Public Member Functions

 McCor (const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()
double corEnergyMc (double eg, double theid)

Private Attributes

bool ntOut
NTuple::Tuple * m_tuple1
NTuple::Item< double > m_ef
NTuple::Item< double > m_e5
NTuple::Item< double > m_ct
NTuple::Item< double > m_ec


Detailed Description

Definition at line 9 of file McCor.h.


Constructor & Destructor Documentation

McCor::McCor ( const std::string name,
ISvcLocator *  pSvcLocator 
)

Definition at line 47 of file McCor.cxx.

References ntOut.

00047                                                             :
00048   Algorithm(name, pSvcLocator) {
00049 
00050     //Declare the properties  
00051   ntOut = true;
00052   declareProperty("NTupleOut",ntOut);
00053 
00054 /*
00055   declareProperty("b0",m_b[0] = 0.9976);
00056   declareProperty("b1",m_b[1] = -0.01718);
00057   declareProperty("b2",m_b[2] = 0.01634);
00058 */
00059 
00060 }


Member Function Documentation

double McCor::corEnergyMc ( double  eg,
double  theid 
)

Definition at line 176 of file McCor.cxx.

References dt.

Referenced by execute().

00176                                                {
00177 
00178    double Energy5x5=eg;
00179    if(eg<0.029)eg=0.029;
00180    if(eg>1.76)eg=1.76;
00181    if(theid<=0)theid=0.001;
00182    if(theid>=27)theid=26.999;
00183    Float_t einter = eg + 0.00001;
00184    Float_t tinter = theid+0.0001;
00185    double ecor=dt->Interpolate(einter,tinter);
00186    if(!(ecor))return Energy5x5;
00187    if(ecor<0.5)return Energy5x5;
00188    double EnergyCor=Energy5x5/ecor;
00189    return EnergyCor;
00190 }

StatusCode McCor::execute (  ) 

Definition at line 120 of file McCor.cxx.

References EmcID::barrel_ec(), DstEmcShower::cellId(), corEnergyMc(), cos(), Bes_Common::DEBUG, DstEmcShower::e5x5(), DstEmcShower::energy(), EventModel::EvtRec::EvtRecEvent, EventModel::EvtRec::EvtRecTrackCol, genRecEmupikp::i, Bes_Common::INFO, m_ct, m_e5, m_ec, m_ef, m_tuple1, msgSvc(), ntOut, DstEmcShower::setEnergy(), DstEmcShower::theta(), and EmcID::theta_module().

00120                           {
00121   
00122 
00123   MsgStream log(msgSvc(), name());
00124   log << MSG::INFO << "in execute()" << endreq;
00125 
00126   SmartDataPtr<Event::EventH> eventHeader(eventSvc(),"/Event");
00127   SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
00128   //  log << MSG::INFO << "get event tag OK" << endreq;
00129     log << MSG::DEBUG <<"ncharg, nneu, tottks = " 
00130       << evtRecEvent->totalCharged() << " , "
00131       << evtRecEvent->totalNeutral() << " , "
00132       << evtRecEvent->totalTracks() <<endreq;
00133       
00134   SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(),  EventModel::EvtRec::EvtRecTrackCol);
00135 
00136 
00137   for(int i = 0; i< evtRecEvent->totalTracks(); i++) {
00138 
00139     EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
00140     if(!(*itTrk)->isEmcShowerValid()) continue;
00141     RecEmcShower *emcTrk = (*itTrk)->emcShower();
00142 
00143     int intid = emcTrk->cellId();
00144     Identifier id=Identifier(intid);
00145     int getthetaid = EmcID::theta_module(id);
00146     int getmodule = EmcID::barrel_ec(id);
00147     if(getthetaid>21)getthetaid=43-getthetaid;
00148     if(getmodule==1)getthetaid=getthetaid+6;
00149     double energyF = emcTrk->energy();
00150     double e5x5 = emcTrk->e5x5();
00151     double costheta = cos(emcTrk->theta());
00152     double dthetaid=double(getthetaid);
00153     double energyC = McCor::corEnergyMc(e5x5,dthetaid);
00154 
00155     if(ntOut == true){ 
00156       m_ct = costheta;
00157       m_ef = energyF;
00158       m_e5 = e5x5;
00159       m_ec = energyC;
00160       m_tuple1->write();
00161     }
00162     emcTrk->setEnergy(energyC);
00163 
00164    }
00165 }

StatusCode McCor::finalize (  ) 

Definition at line 168 of file McCor.cxx.

References Bes_Common::INFO, and msgSvc().

00168                            {
00169 
00170   MsgStream log(msgSvc(), name());
00171   log << MSG::INFO << "in finalize()" << endmsg;
00172   return StatusCode::SUCCESS;
00173 }

StatusCode McCor::initialize (  ) 

Definition at line 63 of file McCor.cxx.

References dt, energy, calibUtil::ERROR, genRecEmupikp::i, Bes_Common::INFO, ganga-rec::j, m_ct, m_e5, m_ec, m_ef, m_tuple1, msgSvc(), ntOut, ntupleSvc(), and deljobs::string.

00063                             {
00064   MsgStream log(msgSvc(), name());
00065   log << MSG::INFO << "in initialize()" << endmsg;
00066   StatusCode status;
00067   if(ntOut == true){
00068     NTuplePtr nt1(ntupleSvc(), "FILE1/ec");
00069     if ( nt1 ) m_tuple1 = nt1;
00070     else {
00071       m_tuple1 = ntupleSvc()->book ("FILE1/ec", CLID_ColumnWiseTuple, "ks N-Tuple example");
00072       if ( m_tuple1 )    {
00073         status = m_tuple1->addItem ("ef",   m_ef);
00074         status = m_tuple1->addItem ("e5",   m_e5);
00075         status = m_tuple1->addItem ("ec",    m_ec);
00076         status = m_tuple1->addItem ("ct",   m_ct);
00077       }
00078       else    { 
00079         log << MSG::ERROR << "    Cannot book N-tuple:" << long(m_tuple1) << endmsg;
00080         return StatusCode::FAILURE;
00081       }
00082     }
00083   }
00084 /*
00085   string CoeffPath=getenv("MCCORROOT");
00086   CoeffPath +="/share/McCorCoeff.txt";
00087   ifstream in;
00088   in.open(CoeffPath.c_str(),ios::in);
00089   for(int i=0;i<4;i++){
00090     in>>m_a[i];
00091     in>>m_ae[i];
00092   }
00093 */
00094   double energy,thetaid,peak,peakerr,res,reserr;
00095   string DataPath;
00096   DataPath=getenv("MCCORROOT");
00097   DataPath += "/share/evset.txt";
00098   ifstream in1;
00099   in1.open(DataPath.c_str(),ios::in);
00100 //  in.open("$MCCORROOT/share/evsc.txt");
00101   double ep[18]={0.03,0.04,0.05,0.075,0.1,0.125,0.15,0.2,0.25,0.3,0.4,0.5,0.75,1.0,1.25,1.5,1.75,2.0};
00102   for(int i=0;i<504;i++){
00103     in1>>energy;
00104     in1>>thetaid;
00105     in1>>peak;
00106     in1>>peakerr;
00107     in1>>res;
00108     in1>>reserr;
00109     int j = i/28;
00110     dt->SetPoint(i,energy,thetaid,peak);
00111     dt->SetPointError(i,0,0,peakerr);
00112   }
00113   in1.close();
00114   log << MSG::INFO << "successfully return from initialize()" <<endmsg;
00115   return StatusCode::SUCCESS;
00116 
00117 }


Member Data Documentation

NTuple::Item<double> McCor::m_ct [private]

Definition at line 23 of file McCor.h.

Referenced by execute(), and initialize().

NTuple::Item<double> McCor::m_e5 [private]

Definition at line 22 of file McCor.h.

Referenced by execute(), and initialize().

NTuple::Item<double> McCor::m_ec [private]

Definition at line 24 of file McCor.h.

Referenced by execute(), and initialize().

NTuple::Item<double> McCor::m_ef [private]

Definition at line 21 of file McCor.h.

Referenced by execute(), and initialize().

NTuple::Tuple* McCor::m_tuple1 [private]

Definition at line 20 of file McCor.h.

Referenced by execute(), and initialize().

bool McCor::ntOut [private]

Definition at line 18 of file McCor.h.

Referenced by execute(), initialize(), and McCor().


Generated on Tue Nov 29 23:20:05 2016 for BOSS_7.0.2 by  doxygen 1.4.7