//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Conversion of FOPI RPC hits ("RpcTrack") to // planar Genfit hits // // Environment: // Software developed for the GEM-TPC in FOPI // // Author List: // Felix Boehmer, E18 TUM (original author) // //----------------------------------------------------------- // This Class' Header ------------------ #include "FopiRpcInitTask.h" #include "TClonesArray.h" #include "TMath.h" #include "RpcPixHit.h" #include "RpcTrack.h" #include // Class Member definitions ----------- ClassImp(FopiRpcInitTask) FopiRpcInitTask::FopiRpcInitTask() : fHitBranchName("RpcTrack"), fOutBranchName("RpcPixHit"), fVerbose(false), fHitArray(NULL), fOutArray(NULL), fPersistence(kFALSE), fConstantOffset(kFALSE), fUseConstSigZ(kFALSE), fHitArrID(-1), fConstSigPhi(4.6/TMath::Sqrt(12.)) //_weightedPlaneConstruction(kFALSE), // _cutCov(kFALSE) { initModuleLookup(); } FopiRpcInitTask::~FopiRpcInitTask() {;} InitStatus FopiRpcInitTask::Init() { //Get ROOT Manager FairRootManager* ioman= FairRootManager::Instance(); if(ioman==NULL){ Error("FopiRpcInitTask::Init","RootManager not instantiated!"); return kERROR; } // get input arrays fHitArray=(TClonesArray*) ioman->GetObject(fHitBranchName); if(fHitArray==NULL){ Error("FopiRpcInitTask::Init","RPC Hit-Array not found!"); return kERROR; } // create and register output array fOutArray = new TClonesArray("RpcPixHit"); ioman->Register(fOutBranchName,"GenFit",fOutArray,fPersistence); fHitArrID = FairRootManager::Instance()->GetBranchId(fOutBranchName); return kSUCCESS; } void FopiRpcInitTask::Exec(Option_t* opt) { // Reset output Arrays if(fOutArray==NULL) Fatal("FopiRpcInitTask::Exec()","No OutTrackArray"); fOutArray->Delete(); if(fVerbose) std::cout<<"FopiRpcInitTask::Exec() ... \n"; //create recohits from CdcHits: int nRpcHits = fHitArray->GetEntriesFast(); for(int irpc=0; irpcGetSuperMod(); double zPos = ir->GetDetX(); //this is the detector Z measurement double zPosSig = ir->GetDetXSig(); double x = ir->GetGlobX(); double y = ir->GetGlobY(); double z = 0.; if(fConstantOffset) { z = zPos + _zOffset; } else { double rad = TMath::Sqrt(x*x + y*y); double theta = ir->GetTheta()*TMath::Pi()/180.; z = rad / TMath::Tan(theta); } TVector3 pos; pos.SetXYZ(x,y,z); TVector3 dir; dir.SetXYZ(0.,0.,1.); int nOut = fOutArray->GetEntriesFast(); double phiMod; bool valid = true; if(fModLookup.count(module)) phiMod = fModLookup[module]; else { std::cout<<"FopiRpcInitTask::Exec() Warning: Invalid module number! " <<"Skipping this point..."<setValid(valid); out->setHitBranchID(fHitArrID); out->setHitID(nOut); } if(fVerbose) std::cout<<"FopiRpcInitTask::Exec() Set up "<