Event.cpp

Go to the documentation of this file.
00001 
00002 #include "cafe/Event.hpp"
00003 
00004 namespace cafe {
00005     
00006   Event::Event()
00007   {
00008   }
00009 
00010   bool Event::isMC() const
00011   //
00012   // Purpose: Tell if event is mc.  The algorithm is similar to 
00013   //          HistorySelector::is_monte_carlo, namely, it checks a) history,
00014   //          b) TMBMCevtInfo::nchunks() > 0, or c) run number == 1 
00015   //          (else data).
00016   //
00017   {
00018     bool is_mc = false;
00019 
00020     // First check run number in TMBGlobal.  Assume run 1 is always mc.
00021 
00022     const TMBGlobal* global = getGlobal();
00023     is_mc = global != 0 && global->runno() == 1;
00024       
00025     // Next look for program "d0gstar" in TMBHistory.
00026 
00027     if(!is_mc) {
00028       const Collection<TMBHistory> history = getHistory();
00029       for(Collection<TMBHistory>::const_iterator i = history.begin();
00030           i != history.end(); ++i) {
00031         const TMBHistory& hist = *i;
00032         if(hist.program() == std::string("d0gstar")) {
00033           is_mc = true;
00034           break;
00035         }
00036       }
00037     }
00038 
00039     // Finally check if TMBMCevtInfo::nchunks() > 0.
00040 
00041     if(!is_mc) {
00042       const TMBMCevtInfo* mcinfo = getMCEventInfo();
00043       is_mc = mcinfo != 0 && mcinfo->nchunks() > 0;
00044     }
00045 
00046     // Done
00047 
00048     return is_mc;
00049   }
00050 
00051   bool Event::isRun2b() const
00052   {
00053     bool is_2b = false;
00054 
00055     // Data or mc?
00056 
00057     if(isMC()) {
00058 
00059       // For mc, the run 2a vs. run 2b determination is based on the 
00060       // d0gstar program version from TMBHistory.  Any version later than
00061       // t05.09.00 or p20.00.00 is assumed to be run 2b.  It is a fatal
00062       // error if a d0gstar TMBHistory object isn't found.
00063 
00064       const TMBHistory* phist = 0;
00065       const Collection<TMBHistory> history = getHistory();
00066       for(Collection<TMBHistory>::const_iterator i = history.begin();
00067           i != history.end(); ++i) {
00068         phist = &*i;
00069         assert(phist != 0);
00070         if(phist->program() == std::string("d0gstar"))
00071           break;
00072       }
00073       if(phist == 0) {
00074         assert(phist != 0);
00075         abort();
00076       }
00077           
00078       std::string version_tag = phist->version();
00079 
00080       // We only know how to definitively interpret standard 9-character
00081       // test and production version tags: txx.yy.zz or pxx.yy.zz.  In
00082       // these cases, do a straight lexical comparison with the cutoff
00083       // version.  Assume any version tag that doesn't conform to these
00084       // standard forms is run2a (since there were a few early
00085       // production releases with weird names), but print an error
00086       // message.  Don't think anyone should be using them any more, but
00087       // you never know.
00088 
00089       if(version_tag.size() == 9 && 
00090          version_tag.substr(0,1) == std::string("t")) {
00091 
00092         // Check test release.
00093 
00094         is_2b = version_tag >= std::string("t05.09.00");
00095       }
00096       else if(version_tag.size() == 9 && 
00097               version_tag.substr(0,1) == std::string("p")) {
00098 
00099         // Check production release.
00100 
00101         is_2b = version_tag >= std::string("p20.00.00");
00102       }
00103       else {
00104 
00105         // Nonstandard version tag.
00106 
00107         std::cerr << "cafe::Event::isRun2b - Nonstandard d0gstar version "
00108                   << version_tag << ", assuming run 2a." << std::endl;
00109       }
00110     }
00111     else {
00112 
00113       // For data, the determination whether this is run 2a or run 2b is
00114       // based on run number, with the cutoff being run 219000.
00115 
00116       const TMBGlobal* global = getGlobal();
00117       if(global == 0) {
00118         assert(global != 0);
00119         abort();
00120       }
00121       is_2b = global->runno() >= 219000;
00122     }
00123 
00124     return is_2b;
00125   }
00126 }
00127 
00128 ClassImp(cafe::Event);
00129 
00130 ClassImp(cafe::Collection<TMBHistory>);
00131 ClassImp(cafe::Collection<TMBTrigger>);
00132 
00133 ClassImp(cafe::Collection<TMBLorentzVector>);
00134 ClassImp(cafe::Collection<TMBMuon>);
00135 ClassImp(cafe::Collection<TMBEMCluster>);
00136 ClassImp(cafe::Collection<TMBJet>);
00137 ClassImp(cafe::Collection<TMBParticleJet>);
00138 ClassImp(cafe::Collection<TMBTrack>);
00139 ClassImp(cafe::Collection<TMBIsoTrack>);
00140 ClassImp(cafe::Collection<TMBVertex>);
00141 ClassImp(cafe::Collection<TMBPrimaryVertex>);
00142 ClassImp(cafe::Collection<TMBTrackCal>);
00143 ClassImp(cafe::Collection<TMBTrackCalJet>);
00144 ClassImp(cafe::Collection<TMBTau>);
00145 
00146 ClassImp(cafe::Collection<TMBCps>);
00147 ClassImp(cafe::Collection<TMBCpsDigi>);
00148 ClassImp(cafe::Collection<TMBFps>);
00149 ClassImp(cafe::Collection<TMBFpsData>);
00150 ClassImp(cafe::Collection<TMBFpd>);
00151 
00152 ClassImp(cafe::Collection<TMBMCvtx>);
00153 ClassImp(cafe::Collection<TMBMCpart>);
00154 
00155 ClassImp(cafe::Collection<TMBL1CalTile>);
00156 ClassImp(cafe::Collection<TMBL1CalTower>);
00157 ClassImp(cafe::Collection<TMBL1Track>);
00158 ClassImp(cafe::Collection<TMBL1toL2CTT>);
00159 ClassImp(cafe::Collection<TMBL2Base>);
00160 ClassImp(cafe::Collection<TMBL2CPS>);
00161 ClassImp(cafe::Collection<TMBL2EM>);
00162 ClassImp(cafe::Collection<TMBL2Muon>);
00163 ClassImp(cafe::Collection<TMBL2Jet>);
00164 ClassImp(cafe::Collection<TMBL2Track>);
00165 ClassImp(cafe::Collection<TMBL2GblJet>);
00166 ClassImp(cafe::Collection<TMBL2GblMuon>);
00167 ClassImp(cafe::Collection<TMBL2GblEM>);
00168 ClassImp(cafe::Collection<TMBL2GblTrack>);
00169 ClassImp(cafe::Collection<TMBL2GblInvMass>);
00170 ClassImp(cafe::Collection<TMBL2GblMJt>);
00171 ClassImp(cafe::Collection<TMBL2GblHt>);
00172 
00173 ClassImp(cafe::Collection<TMBL3Base>);
00174 ClassImp(cafe::Collection<TMBL3BTagIP>);
00175 ClassImp(cafe::Collection<TMBL3CFTVtx>);
00176 ClassImp(cafe::Collection<TMBL3Ele>);
00177 ClassImp(cafe::Collection<TMBL3IPTrack>);
00178 ClassImp(cafe::Collection<TMBL3Isolation>);
00179 ClassImp(cafe::Collection<TMBL3Jet>);
00180 ClassImp(cafe::Collection<TMBL3Muon>);
00181 ClassImp(cafe::Collection<TMBL3Photon>);
00182 ClassImp(cafe::Collection<TMBL3Tau>);
00183 ClassImp(cafe::Collection<TMBL3Track>);
00184 ClassImp(cafe::Collection<TMBL3MEt>);
00185 
00186 ClassImp(cafe::Collection<TMBLum>);
00187 ClassImp(cafe::Collection<TMBLumV>);
00188 ClassImp(cafe::Collection<TMBSimCAEP>);
00189 
00190 ClassImp(cafe::Collection<EventWeight>);
00191 
00192 ClassImp(cafe::Collection<TMBBTag>);
00193 ClassImp(cafe::Collection<TMBBTagSLT>);
00194 ClassImp(cafe::Collection<TMBBTagJLIP>);
00195 ClassImp(cafe::Collection<TMBBTagSVT>);
00196 ClassImp(cafe::Collection<TMBBTagNN>);
00197 
00198 ClassImp(cafe::Collection<TMBLeBob>);
00199 ClassImp(cafe::Collection<TMBHiPt>);
00200 
00201 ClassImp(cafe::Collection<TMBTdc>);
00202 ClassImp(cafe::Collection<TMBFPDTrack>);
00203 

Generated on Thu Apr 3 04:14:23 2008 for CAF by doxygen 1.3.4