00001
00002
00003
00004
00005 #include <iostream>
00006
00007
00008 #include "StPythiaEvent.h"
00009 #include "StJetSkimEvent.h"
00010
00011 ClassImp(StJetSkimTrigHeader)
00012 ClassImp(StJetSkimTrig)
00013 ClassImp(StJetSkimVert)
00014 ClassImp(StJetSkimEvent)
00015
00016 StJetSkimTrigHeader::StJetSkimTrigHeader() {
00017 init();
00018 }
00019
00020 StJetSkimTrigHeader::StJetSkimTrigHeader(const StJetSkimTrigHeader & t) {
00021 this->runId = t.runId;
00022 this->trigId = t.trigId;
00023 this->prescale = t.prescale;
00024 this->eastBarrelTowerThreshold = t.eastBarrelTowerThreshold;
00025 this->eastBarrelTriggerPatchThreshold = t.eastBarrelTriggerPatchThreshold;
00026 this->eastBarrelJetPatchThreshold = t.eastBarrelJetPatchThreshold;
00027 this->westBarrelTowerThreshold = t.westBarrelTowerThreshold;
00028 this->westBarrelTriggerPatchThreshold = t.westBarrelTriggerPatchThreshold;
00029 this->westBarrelJetPatchThreshold = t.westBarrelJetPatchThreshold;
00030 this->endcapTowerThreshold = t.endcapTowerThreshold;
00031 this->endcapTriggerPatchThreshold = t.endcapTriggerPatchThreshold;
00032 this->endcapJetPatchThreshold = t.endcapJetPatchThreshold;
00033 this->totalEnergyThreshold = t.totalEnergyThreshold;
00034 }
00035
00036 StJetSkimTrigHeader::~StJetSkimTrigHeader() { }
00037
00038 StJetSkimTrigHeader& StJetSkimTrigHeader::operator=(const StJetSkimTrigHeader & rhs) {
00039 if(this != &rhs) {
00040 TObject::operator=(rhs);
00041
00042 this->runId = rhs.runId;
00043 this->trigId = rhs.trigId;
00044 this->prescale = rhs.prescale;
00045 this->eastBarrelTowerThreshold = rhs.eastBarrelTowerThreshold;
00046 this->eastBarrelTriggerPatchThreshold = rhs.eastBarrelTriggerPatchThreshold;
00047 this->eastBarrelJetPatchThreshold = rhs.eastBarrelJetPatchThreshold;
00048 this->westBarrelTowerThreshold = rhs.westBarrelTowerThreshold;
00049 this->westBarrelTriggerPatchThreshold = rhs.westBarrelTriggerPatchThreshold;
00050 this->westBarrelJetPatchThreshold = rhs.westBarrelJetPatchThreshold;
00051 this->endcapTowerThreshold = rhs.endcapTowerThreshold;
00052 this->endcapTriggerPatchThreshold = rhs.endcapTriggerPatchThreshold;
00053 this->endcapJetPatchThreshold = rhs.endcapJetPatchThreshold;
00054 this->totalEnergyThreshold = rhs.totalEnergyThreshold;
00055 }
00056
00057 return *this;
00058 }
00059
00060 void StJetSkimTrigHeader::Clear(const char *option) {
00061 TObject::Clear(option);
00062 init();
00063 }
00064
00065 void StJetSkimTrigHeader::init() {
00066 this->runId = -1;
00067 this->trigId = -1;
00068 this->prescale = 0.;
00069 this->eastBarrelTowerThreshold = -1;
00070 this->eastBarrelTriggerPatchThreshold = -1;
00071 this->eastBarrelJetPatchThreshold = -1;
00072 this->westBarrelTowerThreshold = -1;
00073 this->westBarrelTriggerPatchThreshold = -1;
00074 this->westBarrelJetPatchThreshold = -1;
00075 this->endcapTowerThreshold = -1;
00076 this->endcapTriggerPatchThreshold = -1;
00077 this->endcapJetPatchThreshold = -1;
00078 this->totalEnergyThreshold = -1;
00079 }
00080
00081 StJetSkimTrig::StJetSkimTrig() : TObject()
00082 {
00083 init();
00084 }
00085
00086 StJetSkimTrig::StJetSkimTrig(const StJetSkimTrig& t) : TObject()
00087 {
00088 this->mTrigId = t.trigId();
00089 this->mDidFire = t.didFire();
00090 this->mShouldFire = t.shouldFire();
00091 this->mShouldFireBBC = t.shouldFireBBC();
00092 this->mShouldFireBemc = t.shouldFireBemc();
00093 this->mShouldFireEemc = t.shouldFireEemc();
00094 this->mShouldFireL2 = t.shouldFireL2();
00095 this->mTowers = t.mTowers;
00096 this->mTriggerPatches = t.mTriggerPatches;
00097 this->mJetPatches = t.mJetPatches;
00098 this->mTotalEnergy = t.totalEnergy();
00099
00100 memcpy(this->mL2ResultEmulated,t.mL2ResultEmulated,sizeof(this->mL2ResultEmulated));
00101 }
00102
00103 StJetSkimTrig::~StJetSkimTrig() { }
00104
00105 StJetSkimTrig& StJetSkimTrig::operator=(const StJetSkimTrig& rhs)
00106 {
00107 if(this != &rhs) {
00108 TObject::operator=(rhs);
00109
00110 this->mTrigId = rhs.trigId();
00111 this->mDidFire = rhs.didFire();
00112 this->mShouldFire = rhs.shouldFire();
00113 this->mShouldFireBBC = rhs.shouldFireBBC();
00114 this->mShouldFireBemc = rhs.shouldFireBemc();
00115 this->mShouldFireEemc = rhs.shouldFireEemc();
00116 this->mShouldFireL2 = rhs.shouldFireL2();
00117 this->mTowers = rhs.mTowers;
00118 this->mTriggerPatches = rhs.mTriggerPatches;
00119 this->mJetPatches = rhs.mJetPatches;
00120 this->mTotalEnergy = rhs.totalEnergy();
00121
00122 memcpy(this->mL2ResultEmulated,rhs.mL2ResultEmulated,sizeof(this->mL2ResultEmulated));
00123 }
00124
00125 return *this;
00126 }
00127
00128 void StJetSkimTrig::init() {
00129 this->mTrigId = -1;
00130 this->mDidFire = -1;
00131 this->mShouldFire = -1;
00132 this->mShouldFireBBC = -1;
00133 this->mShouldFireBemc = -1;
00134 this->mShouldFireEemc = -1;
00135 this->mShouldFireL2 = -1;
00136 this->mTotalEnergy = -1;
00137 this->mTowers.clear();
00138 this->mTriggerPatches.clear();
00139 this->mJetPatches.clear();
00140
00141 memset(this->mL2ResultEmulated,0,sizeof(this->mL2ResultEmulated));
00142 }
00143
00144 void StJetSkimTrig::clear() {
00145 this->Clear();
00146 }
00147
00148 void StJetSkimTrig::Clear(const char *option) {
00149 TObject::Clear(option);
00150 init();
00151 }
00152
00153 map<int,int>& StJetSkimTrig::towersAboveThreshold(int detector) const{
00154 map<int,int> *theMap = new map<int,int>;
00155 for(map<int,int>::const_iterator it=mTowers.begin(); it!=mTowers.end(); it++) {
00156 if( (detector==0) && (it->first > 0) ) {
00157 (*theMap)[it->first] = it->second;
00158 }
00159 else if( (detector==1) && (it->first <= 0) ) {
00160 (*theMap)[TMath::Abs(it->first)] = it->second;
00161 }
00162 }
00163 return (*theMap);
00164 }
00165
00166 map<int,int>& StJetSkimTrig::triggerPatchesAboveThreshold(int detector) const{
00167 map<int,int> *theMap = new map<int,int>;
00168 for(map<int,int>::const_iterator it=mTriggerPatches.begin(); it!=mTriggerPatches.end(); it++) {
00169 if( (detector==0) && (it->first > 0) ) {
00170 (*theMap)[it->first - 1] = it->second;
00171 }
00172 else if( (detector==1) && (it->first <= 0) ) {
00173 (*theMap)[TMath::Abs(it->first)] = it->second;
00174 }
00175 }
00176 return (*theMap);
00177 }
00178
00179 map<int,int>& StJetSkimTrig::jetPatchesAboveThreshold(int detector) const{
00180 map<int,int> *theMap = new map<int,int>;
00181 for(map<int,int>::const_iterator it=mJetPatches.begin(); it!=mJetPatches.end(); it++) {
00182 if( (detector==0) && (it->first > 0) ) {
00183 (*theMap)[it->first - 1] = it->second;
00184 }
00185 else if( (detector==1) && (it->first <= 0) ) {
00186 (*theMap)[TMath::Abs(it->first)] = it->second;
00187 }
00188 }
00189 return (*theMap);
00190 }
00191
00192 void StJetSkimTrig::addTowerAboveThreshold(int detector, int aID, int aADC) {
00193 pair<int,int> p1(aID,aADC);
00194 if(detector == 1) p1.first = (-1)*aID;
00195 pair<map<int,int>::iterator,bool> p2 = mTowers.insert(p1);
00196 if(!p2.second) {
00197 cerr << "Error! towersAboveThreshold map already contains key == " << p1.first << endl;
00198 }
00199 }
00200
00201 void StJetSkimTrig::addTriggerPatchAboveThreshold(int detector, int aID, int aADC) {
00202 pair<int,int> p1(aID+1,aADC);
00203 if(detector == 1) p1.first = (-1)*aID;
00204 pair<map<int,int>::iterator,bool> p2 = mTriggerPatches.insert(p1);
00205 if(!p2.second) {
00206 cerr << "Error! triggerPatchesAboveThreshold map already contains key == " << p1.first << endl;
00207 }
00208 }
00209
00210 void StJetSkimTrig::addJetPatchAboveThreshold(int detector, int aID, int aADC) {
00211 pair<int,int> p1(aID+1,aADC);
00212 if(detector == 1) p1.first = (-1)*aID;
00213 pair<map<int,int>::iterator,bool> p2 = mJetPatches.insert(p1);
00214 if(!p2.second) {
00215 cerr << "Error! jetPatchesAboveThreshold map already contains key == " << p1.first << endl;
00216 }
00217 }
00218
00219 void StJetSkimTrig::setL2ResultEmulated(const int* rhs) {
00220 memcpy(mL2ResultEmulated,rhs,sizeof(mL2ResultEmulated));
00221 }
00222
00223 StJetSkimVert::StJetSkimVert()
00224 {
00225 for (int i=0; i<3; ++i) {
00226 mPosition[i] = 0.;
00227 mPosError[i] = 0.;
00228 }
00229 mVertexFinderId = mNTracksUsed = mNBTOFMatch = mNCTBMatch = mNBEMCMatch = mNEEMCMatch = mNCrossCentralMembrane = mRefMultNeg = mRefMultPos = mRefMultFtpcWest = mRefMultFtpcEast = 0;
00230 mRanking = mSumTrackPt = mMeanDip = mChiSquared = 0.;
00231 }
00232
00233 void StJetSkimVert::setPosition(float* x)
00234 {
00235 mPosition[0] = x[0];
00236 mPosition[1] = x[1];
00237 mPosition[2] = x[2];
00238 }
00239 void StJetSkimVert::setError(float* x)
00240 {
00241 mPosError[0] = x[0];
00242 mPosError[1] = x[1];
00243 mPosError[2] = x[2];
00244 }
00245
00246
00247
00248 void StJetSkimVert::clear()
00249 {
00250 for (int i=0; i<3; ++i) {
00251 mPosition[i] = 0.;
00252 mPosError[i] = 0.;
00253 }
00254 mVertexFinderId = mNTracksUsed = mNBTOFMatch = mNCTBMatch = mNBEMCMatch = mNEEMCMatch = mNCrossCentralMembrane = mRefMultNeg = mRefMultPos = mRefMultFtpcWest = mRefMultFtpcEast = 0;
00255 mRanking = mSumTrackPt = mMeanDip = mChiSquared = 0.;
00256 }
00257
00258 void StJetSkimVert::Clear(const char *option) {
00259 this->clear();
00260 TObject::Clear(option);
00261 }
00262
00263 bool StJetSkimVert::operator==(const StJetSkimVert &rhs) const {
00264 if (this == &rhs) return true;
00265
00266 for(int i=0; i<3; i++) {
00267 if(mPosition[i] != rhs.position()[i]) return false;
00268 if(mPosError[i] != rhs.posError()[i]) return false;
00269 }
00270
00271 if(mRanking != rhs.ranking()) return false;
00272 if(mNTracksUsed != rhs.nTracksUsed()) return false;
00273 if(mNBTOFMatch != rhs.nBTOFMatch()) return false;
00274 if(mNCTBMatch != rhs.nCTBMatch()) return false;
00275 if(mNBEMCMatch != rhs.nBEMCMatch()) return false;
00276 if(mNEEMCMatch != rhs.nEEMCMatch()) return false;
00277 if(mNCrossCentralMembrane != rhs.nCrossCentralMembrane()) return false;
00278 if(mSumTrackPt != rhs.sumTrackPt()) return false;
00279 if(mMeanDip != rhs.meanDip()) return false;
00280 if(mChiSquared != rhs.chiSquared()) return false;
00281 if(mRefMultNeg != rhs.refMultNeg()) return false;
00282 if(mRefMultPos != rhs.refMultPos()) return false;
00283 if(mRefMultFtpcWest != rhs.refMultFtpcWest()) return false;
00284 if(mRefMultFtpcEast != rhs.refMultFtpcEast()) return false;
00285
00286 return true;
00287 }
00288
00289 StJetSkimEvent::StJetSkimEvent() : TObject(), mTriggers(new TClonesArray("StJetSkimTrig",100)), mVertices(new TClonesArray("StJetSkimVert",100)), mBestVert(NULL), mMcEvent(NULL)
00290 {
00291 mMudstFileName = "Undefined";
00292 mBestVertRef = NULL;
00293 mFill = mRunId = mEventId = mbx7 = mbx48 = mSpinBits = 0;
00294 mEbbc = mWbbc = mBbcTimeBin = 0;
00295 mZdcWestRate = 0;
00296 mZdcEastRate = 0;
00297 mZdcCoincidenceRate = 0;
00298 mBbcWestRate = 0;
00299 mBbcEastRate = 0;
00300 mBbcCoincidenceRate = 0;
00301 mIsValid = mIsPolLong = mIsPolTrans = mIsMaskedUsingBx48 = mOffsetBx48minusBX7 = mSpin4usingBx48 = 0;
00302
00303 memset(mBarrelJetPatchTh,0,sizeof(mBarrelJetPatchTh));
00304 memset(mEndcapJetPatchTh,0,sizeof(mEndcapJetPatchTh));
00305 memset(mOverlapJetPatchTh,0,sizeof(mOverlapJetPatchTh));
00306
00307 memset(mBarrelHighTowerTh,0,sizeof(mBarrelHighTowerTh));
00308 memset(mEndcapHighTowerTh,0,sizeof(mEndcapHighTowerTh));
00309
00310 memset(mBarrelJetPatchAdc,0,sizeof(mBarrelJetPatchAdc));
00311 memset(mEndcapJetPatchAdc,0,sizeof(mEndcapJetPatchAdc));
00312 memset(mOverlapJetPatchAdc,0,sizeof(mOverlapJetPatchAdc));
00313
00314 mEmcLayer2 = 0;
00315 }
00316
00317 StJetSkimEvent::StJetSkimEvent(const StJetSkimEvent &other) : TObject()
00318 {
00319 this->mFill = other.fill();
00320 this->mRunId = other.runId();
00321 this->mEventId = other.eventId();
00322 this->mMudstFileName= other.mudstFileName();
00323
00324 mTriggers = new TClonesArray("StJetSkimTrig",100);
00325 for(int i=0; i<other.triggers()->GetEntries(); i++) {
00326 this->setTrig(*(StJetSkimTrig*)other.triggers()->At(i));
00327 }
00328
00329 mVertices = new TClonesArray("StJetSkimTrig",100);
00330 for(int i=0; i<other.vertices()->GetEntries(); i++) {
00331 this->setVert(*(StJetSkimVert*)other.vertices()->At(i));
00332 }
00333
00334 mBestVert = other.bestVert();
00335 if(mBestVert) this->setBestVert(*mBestVert);
00336 mBestVert = NULL;
00337
00338 this->mbx7 = other.bx7();
00339 this->mbx48 = other.bx48();
00340 this->mSpinBits = other.spinBits();
00341 this->mEbbc = other.eBbc();
00342 this->mWbbc = other.wBbc();
00343 this->mBbcTimeBin = other.bbcTimeBin();
00344
00345 mZdcWestRate = other.mZdcWestRate;
00346 mZdcEastRate = other.mZdcEastRate;
00347 mZdcCoincidenceRate = other.mZdcCoincidenceRate;
00348 mBbcWestRate = other.mBbcWestRate;
00349 mBbcEastRate = other.mBbcEastRate;
00350 mBbcCoincidenceRate = other.mBbcCoincidenceRate;
00351
00352 this->mIsValid = other.isValid();
00353 this->mIsPolLong = other.isPolLong();
00354 this->mIsPolTrans = other.isPolTrans();
00355 this->mIsMaskedUsingBx48 = other.isMaskedUsingBx48();
00356 this->mOffsetBx48minusBX7 = other.offsetBx48minusBX7();
00357 this->mSpin4usingBx48 = other.spin4usingBx48();
00358
00359 memcpy(mL2Result,other.mL2Result,sizeof(mL2Result));
00360
00361 memcpy(mBarrelJetPatchTh,other.mBarrelJetPatchTh,sizeof(mBarrelJetPatchTh));
00362 memcpy(mEndcapJetPatchTh,other.mEndcapJetPatchTh,sizeof(mEndcapJetPatchTh));
00363 memcpy(mOverlapJetPatchTh,other.mOverlapJetPatchTh,sizeof(mOverlapJetPatchTh));
00364
00365 memcpy(mBarrelHighTowerTh,other.mBarrelHighTowerTh,sizeof(mBarrelHighTowerTh));
00366 memcpy(mEndcapHighTowerTh,other.mEndcapHighTowerTh,sizeof(mEndcapHighTowerTh));
00367
00368 memcpy(mBarrelJetPatchAdc,other.mBarrelJetPatchAdc,sizeof(mBarrelJetPatchAdc));
00369 memcpy(mEndcapJetPatchAdc,other.mEndcapJetPatchAdc,sizeof(mEndcapJetPatchAdc));
00370 memcpy(mOverlapJetPatchAdc,other.mOverlapJetPatchAdc,sizeof(mOverlapJetPatchAdc));
00371
00372 mEmcLayer2 = other.mEmcLayer2;
00373 }
00374
00375 StJetSkimEvent::~StJetSkimEvent()
00376 {
00377 if(mTriggers) mTriggers->Delete();
00378 if(mVertices) mVertices->Delete();
00379 }
00380
00381 StJetSkimEvent& StJetSkimEvent::operator=(const StJetSkimEvent &rhs)
00382 {
00383 if(this != &rhs) {
00384 TObject::operator=(rhs);
00385
00386 this->mFill = rhs.fill();
00387 this->mRunId = rhs.runId();
00388 this->mEventId = rhs.eventId();
00389 this->mMudstFileName= rhs.mudstFileName();
00390
00391 mTriggers->Delete();
00392 for(int i=0; i<rhs.triggers()->GetEntries(); i++) {
00393 this->setTrig(*(StJetSkimTrig*)rhs.triggers()->At(i));
00394 }
00395
00396 mVertices->Delete();
00397 for(int i=0; i<rhs.vertices()->GetEntries(); i++) {
00398 this->setVert(*(StJetSkimVert*)rhs.vertices()->At(i));
00399 }
00400
00401 mBestVert = rhs.bestVert();
00402 if(mBestVert) this->setBestVert(*mBestVert);
00403 mBestVert = NULL;
00404
00405 this->mbx7 = rhs.bx7();
00406 this->mbx48 = rhs.bx48();
00407 this->mSpinBits = rhs.spinBits();
00408 this->mEbbc = rhs.eBbc();
00409 this->mWbbc = rhs.wBbc();
00410 this->mBbcTimeBin = rhs.bbcTimeBin();
00411
00412 mZdcWestRate = rhs.mZdcWestRate;
00413 mZdcEastRate = rhs.mZdcEastRate;
00414 mZdcCoincidenceRate = rhs.mZdcCoincidenceRate;
00415 mBbcWestRate = rhs.mBbcWestRate;
00416 mBbcEastRate = rhs.mBbcEastRate;
00417 mBbcCoincidenceRate = rhs.mBbcCoincidenceRate;
00418
00419 this->mIsValid = rhs.isValid();
00420 this->mIsPolLong = rhs.isPolLong();
00421 this->mIsPolTrans = rhs.isPolTrans();
00422 this->mIsMaskedUsingBx48 = rhs.isMaskedUsingBx48();
00423 this->mOffsetBx48minusBX7 = rhs.offsetBx48minusBX7();
00424 this->mSpin4usingBx48 = rhs.spin4usingBx48();
00425
00426 memcpy(mL2Result,rhs.mL2Result,sizeof(mL2Result));
00427
00428 memcpy(mBarrelJetPatchTh,rhs.mBarrelJetPatchTh,sizeof(mBarrelJetPatchTh));
00429 memcpy(mEndcapJetPatchTh,rhs.mEndcapJetPatchTh,sizeof(mEndcapJetPatchTh));
00430 memcpy(mOverlapJetPatchTh,rhs.mOverlapJetPatchTh,sizeof(mOverlapJetPatchTh));
00431
00432 memcpy(mBarrelHighTowerTh,rhs.mBarrelHighTowerTh,sizeof(mBarrelHighTowerTh));
00433 memcpy(mEndcapHighTowerTh,rhs.mEndcapHighTowerTh,sizeof(mEndcapHighTowerTh));
00434
00435 memcpy(mBarrelJetPatchAdc,rhs.mBarrelJetPatchAdc,sizeof(mBarrelJetPatchAdc));
00436 memcpy(mEndcapJetPatchAdc,rhs.mEndcapJetPatchAdc,sizeof(mEndcapJetPatchAdc));
00437 memcpy(mOverlapJetPatchAdc,rhs.mOverlapJetPatchAdc,sizeof(mOverlapJetPatchAdc));
00438
00439 mEmcLayer2 = rhs.mEmcLayer2;
00440 }
00441
00442 return *this;
00443 }
00444
00445 void StJetSkimEvent::clear()
00446 {
00447 mMudstFileName = "Undefined";
00448 mFill = mRunId = mEventId = mbx7 = mbx48 = mSpinBits = 0;
00449 mEbbc = mWbbc = mBbcTimeBin = 0;
00450 mZdcWestRate = 0;
00451 mZdcEastRate = 0;
00452 mZdcCoincidenceRate = 0;
00453 mBbcWestRate = 0;
00454 mBbcEastRate = 0;
00455 mBbcCoincidenceRate = 0;
00456 mIsValid = mIsPolLong = mIsPolTrans = mIsMaskedUsingBx48 = mOffsetBx48minusBX7 = mSpin4usingBx48 = 0;
00457 mTriggers->Clear("c");
00458 mVertices->Clear("c");
00459 mBestVert = NULL;
00460 mBestVertRef.Clear();
00461 mTrigHeaderArrayRef.Clear();
00462
00463 memset(mBarrelJetPatchTh,0,sizeof(mBarrelJetPatchTh));
00464 memset(mEndcapJetPatchTh,0,sizeof(mEndcapJetPatchTh));
00465 memset(mOverlapJetPatchTh,0,sizeof(mOverlapJetPatchTh));
00466
00467 memset(mBarrelHighTowerTh,0,sizeof(mBarrelHighTowerTh));
00468 memset(mEndcapHighTowerTh,0,sizeof(mEndcapHighTowerTh));
00469
00470 memset(mBarrelJetPatchAdc,0,sizeof(mBarrelJetPatchAdc));
00471 memset(mEndcapJetPatchAdc,0,sizeof(mEndcapJetPatchAdc));
00472 memset(mOverlapJetPatchAdc,0,sizeof(mOverlapJetPatchAdc));
00473
00474 mEmcLayer2 = 0;
00475 }
00476
00477 void StJetSkimEvent::Clear(const char *option) {
00478 this->clear();
00479 TObject::Clear(option);
00480 }
00481
00482 StJetSkimVert* StJetSkimEvent::bestVert() const {
00483 return (mBestVertRef.GetObject() ? (StJetSkimVert*)mBestVertRef.GetObject() : mBestVert);
00484 }
00485
00486 void StJetSkimEvent::setBestVert(const StJetSkimVert & v) {
00487 for(int i=0; i<mVertices->GetEntries(); i++) {
00488 if(v == *(StJetSkimVert*)(mVertices->At(i))) {
00489 this->setBestVert(i);
00490 break;
00491 }
00492 }
00493
00494 if(this->bestVert() == NULL) {
00495 cerr << "StJetSkimEvent::setBestVert -- Error! Couldn't set best vertex" << endl;
00496 cerr << "StJetSkimEvent::setBestVert -- Make sure the vertex is already in the new clones array" << endl;
00497 }
00498 }
00499
00500 void StJetSkimEvent::setBestVert(int clonesArrayIndex) {
00501 mBestVertRef = (StJetSkimVert*)mVertices->At(clonesArrayIndex);
00502 }
00503
00504 void StJetSkimEvent::setL2Result(const int* rhs) {
00505 memcpy(mL2Result,rhs,sizeof(mL2Result));
00506 }
00507
00508 void StJetSkimEvent::setTrig(const StJetSkimTrig& t)
00509 {
00510 int addAt = mTriggers->GetLast()+1;
00511
00512
00513 TClonesArray& arrayRef = *(mTriggers);
00514 new ( arrayRef[addAt]) StJetSkimTrig( t );
00515 }
00516
00517 void StJetSkimEvent::setVert(const StJetSkimVert& t)
00518 {
00519 int addAt = mVertices->GetLast()+1;
00520
00521
00522 TClonesArray& arrayRef = *(mVertices);
00523 new ( arrayRef[addAt]) StJetSkimVert( t );
00524 }
00525
00526 StJetSkimTrigHeader* StJetSkimEvent::trigHeader(int trigId) {
00527 TClonesArray *tmp = this->trigHeaders();
00528 if(!tmp) {
00529 cout << "ERROR LOADING TRIGGER HEADERS!" << endl;
00530 return NULL;
00531 }
00532 for(int i=0; i<tmp->GetEntries(); i++) {
00533 StJetSkimTrigHeader* header = (StJetSkimTrigHeader*)tmp->At(i);
00534 if(header->trigId == trigId) return header;
00535 }
00536 return NULL;
00537 }
00538
00539 StJetSkimTrig* StJetSkimEvent::trigger(int trigId) {
00540 TClonesArray *tmp = this->triggers();
00541 for(int i=0; i<tmp->GetEntries(); i++) {
00542 StJetSkimTrig* trigger = (StJetSkimTrig*)tmp->At(i);
00543 if(trigger->trigId() == trigId) return trigger;
00544 }
00545 return NULL;
00546 }
00547
00548 map<int,int> StJetSkimEvent::barrelJetPatchesAboveTh(int i) const
00549 {
00550 map<int,int> m;
00551 for (int jp = 0; jp < 18; ++jp) {
00552 int adc = barrelJetPatchAdc(jp);
00553 if (adc > barrelJetPatchTh(i)) m.insert(make_pair(jp,adc));
00554 }
00555 return m;
00556 }
00557
00558 map<int,int> StJetSkimEvent::endcapJetPatchesAboveTh(int i) const
00559 {
00560 map<int,int> m;
00561 for (int jp = 0; jp < 6; ++jp) {
00562 int adc = endcapJetPatchAdc(jp);
00563 if (adc > endcapJetPatchTh(i)) m.insert(make_pair(jp,adc));
00564 }
00565 return m;
00566 }
00567
00568 map<int,int> StJetSkimEvent::overlapJetPatchesAboveTh(int i) const
00569 {
00570 map<int,int> m;
00571 for (int jp = 0; jp < 6; ++jp) {
00572 int adc = overlapJetPatchAdc(jp);
00573 if (adc > overlapJetPatchTh(i)) m.insert(make_pair(jp,adc));
00574 }
00575 return m;
00576 }