227 #include "StTpcDbMaker.h"
228 #include "StDbUtilities/StCoordinates.hh"
229 #include "StDbUtilities/StTpcPadCoordinate.hh"
230 #include "StDbUtilities/StMagUtilities.h"
231 #include "StarMagField.h"
232 #include "math_constants.h"
233 #include "StDetectorDbMaker/StDetectorDbTpcRDOMasks.h"
234 #include "StDetectorDbMaker/StDetectorDbMagnet.h"
235 #include "StDetectorDbMaker/St_tpcAnodeHVavgC.h"
236 #include "StDetectorDbMaker/St_tpcChargeEventC.h"
237 #if ROOT_VERSION_CODE < 331013
240 #include "TCernLib.h"
246 static Bool_t Done = kFALSE;
247 if (Done)
return kStOK;
249 Int_t iNewTpcAlignment = 0;
250 if (GetDateTime().GetYear() >= 2013) {
251 iNewTpcAlignment = 1;
253 Int_t iNewTpcAlignmentOld = gEnv->GetValue(
"NewTpcAlignment",0);
254 if (iNewTpcAlignment != iNewTpcAlignmentOld) {
255 gMessMgr->QAInfo() <<
"ReSet environment NewTpcAlignment (year >= 2013) from " << iNewTpcAlignmentOld <<
" to " << iNewTpcAlignment << endm;
256 gEnv->SetValue(
"NewTpcAlignment", iNewTpcAlignment);
260 if (! IAttr(
"Simu")) {
261 Float_t gFactor = StarMagField::Instance()->GetFactor();
264 gMessMgr->Info() <<
"StTpcDbMaker::Full Reverse Field Twist Parameters. If this is an embedding run, you should not use it." << endm;
265 SetFlavor(
"ofl+TFG+FullMagFNegative",
"tpcGlobalPosition");
267 else if (gFactor<-0.2) {
268 gMessMgr->Info() <<
"StTpcDbMaker::Half Reverse Field Twist Parameters. If this is an embedding run, you should not use it." << endm;
269 SetFlavor(
"ofl+TFG+HalfMagFNegative",
"tpcGlobalPosition");
271 else if (gFactor<0.2) {
272 gMessMgr->Info() <<
"StTpcDbMaker::Zero Field Twist Parameters. If this is an embedding run, you should not use it." << endm;
273 SetFlavor(
"ofl+TFG+ZeroMagF",
"tpcGlobalPosition");
275 else if (gFactor<0.8) {
276 gMessMgr->Info() <<
"StTpcDbMaker::Half Forward Field Twist Parameters. If this is an embedding run, you should not use it." << endm;
277 SetFlavor(
"ofl+TFG+HalfMagFPositive",
"tpcGlobalPosition");
279 else if (gFactor<1.2) {
280 gMessMgr->Info() <<
"StTpcDbMaker::Full Forward Field Twist Parameters. If this is an embedding run, you should not use it." << endm;
281 SetFlavor(
"ofl+TFG+FullMagFPositive",
"tpcGlobalPosition");
284 if (IAttr(
"useLDV")) {
285 SetFlavor(
"laserDV",
"tpcDriftVelocity");
286 gMessMgr->Info() <<
"StTpcDbMaker::Using drift velocity from laser analysis" << endm;
287 }
else if (IAttr(
"useNewLDV")) {
288 SetFlavor(
"NewlaserDV",
"tpcDriftVelocity");
289 gMessMgr->Info() <<
"StTpcDbMaker::Using drift velocity from New laser analysis" << endm;
290 }
else if (IAttr(
"useCDV")) {
291 SetFlavor(
"ofl+TFG",
"tpcDriftVelocity");
292 gMessMgr->Info() <<
"StTpcDbMaker::Using drift velocity from T0 analysis" << endm;
294 SetFlavor(
"ofl+TFG+laserDV",
"tpcDriftVelocity");
295 gMessMgr->Info() <<
"StTpcDbMaker::Using any drift velocity" << endm;
297 StTpcDb::instance()->SetDriftVelocity();
303 }
else if ( IAttr(
"EB2") ){
306 if(IAttr(
"OldRuns")) mask = mask | 2 ;
313 if( IAttr(
"OBmap") ) mask |= ( kBMap << 1);
314 if( IAttr(
"OPr13") ) mask |= ( kPadrow13 << 1);
315 if( IAttr(
"OPr40") ) mask |= ( kPadrow40 << 1);
316 if( IAttr(
"OTwist") ) mask |= ( kTwist << 1);
317 if( IAttr(
"OClock") ) mask |= ( kClock << 1);
318 if( IAttr(
"OCentm") ) mask |= ( kMembrane << 1);
319 if( IAttr(
"OECap") ) mask |= ( kEndcap << 1);
320 if( IAttr(
"OIFC") ) mask |= ( kIFCShift << 1);
321 if( IAttr(
"OSpaceZ") ) mask |= ( kSpaceCharge << 1);
322 if( IAttr(
"OSpaceZ2") ) mask |= ( kSpaceChargeR2 << 1);
323 if( IAttr(
"OSpaceFXT") ) mask |= ( kSpaceChargeFXT << 1);
324 if( IAttr(
"OShortR") ) mask |= ( kShortedRing << 1);
325 if( IAttr(
"OBMap2d") ) mask |= ( kFast2DBMap << 1);
326 if( IAttr(
"OGridLeak") ) mask |= ( kGridLeak << 1);
327 if( IAttr(
"OGridLeak3D") ) mask |= ( k3DGridLeak << 1);
328 if( IAttr(
"OGridLeakFull")) mask |= ( kFullGridLeak << 1);
329 if( IAttr(
"OGGVoltErr") ) mask |= ( kGGVoltError << 1);
330 if( IAttr(
"OSectorAlign") ) mask |= ( kSectorAlign << 1);
331 if( IAttr(
"ODistoSmear") ) mask |= ( kDistoSmearing << 1);
332 if( IAttr(
"OAbortGap") ) mask |= ( kAbortGap << 1);
333 LOG_QA <<
"Instantiate ExB The option passed will be " << Form(
"%d 0x%X\n",mask,mask) << endm;
335 Int_t option = (mask & 0x7FFFFFFE) >> 1;
336 #ifndef __NEW_MagUtilities__
342 StTpcDb::instance()->SetTpcRotations();
348 if (St_tpcAnodeHVavgC::instance()->tripped()) {
349 gMessMgr->Info() <<
"StTpcDbMaker::TPC has tripped - declaring EOF to avoid possibly bad data" << endm;
352 StTpcDb::instance()->SetDriftVelocity();
354 if (IAttr(
"laserIT")) {
355 St_trgTimeOffsetC::instance()->SetLaser(kFALSE);
363 StTpcDb::instance()->SetTriggerId(TriggerId);
364 static Int_t goodIds[2] = {9200,9201};
365 for (Int_t i = 0; i < 2; i++) {
366 if (nominal->isTrigger(goodIds[i])) {TriggerId = goodIds[i];
break;}
369 St_trgTimeOffsetC::instance()->SetLaser(kTRUE);
370 StTpcDb::instance()->SetTriggerId(TriggerId);
374 if (IAttr(
"OAbortGap")) {
376 if (trg) St_tpcChargeEventC::instance()->findChargeTimes(trg->bunchCounter());
379 if (! St_trgTimeOffsetC::instance()->IsLaser())
return kStSkip;
Collection of trigger ids as stored in StEvent.