/* * PndLumiRecoTask.cxx * * Created on: Nov 10, 2008 * Author: tsito */ #include "PndLumiRecoTask.h" PndLumiRecoTask::PndLumiRecoTask(Double_t pitch, Double_t sigma, Double_t orient) { fPitch = pitch; fSigma = sigma; fOrient = orient; } InitStatus PndLumiRecoTask::Init() { // Get RootManager FairRootManager* ioman = FairRootManager::Instance(); if ( ! ioman ){ cout << "-E- PndLumiRecoTask::Init: " << "RootManager not instantiated!" << endl; return kFATAL; } // Get input array fLumiClusterArrayFront = (TClonesArray*) ioman->GetObject("LumiClusterFront"); fLumiClusterArrayBack = (TClonesArray*) ioman->GetObject("LumiClusterBack"); if (!fLumiClusterArrayFront){ cout << "-W- PndLumiRecoTask::Init: " << "No LumiCluster collection!" << endl; return kERROR; } if (!fLumiClusterArrayBack){ cout << "-W- PndLumiRecoTask::Init: " << "No LumiCluster collection!" << endl; return kERROR; } //Get Output array fLumiRecoArray = new TClonesArray("PndLumiRecoHit"); ioman->Register("LumiRecoHit", "Lumi", fLumiRecoArray, kTRUE); return kSUCCESS; } void PndLumiRecoTask::Exec(Option_t* opt) { if (!fLumiRecoArray) Fatal("Exec", "No Reconstructed Array"); fLumiRecoArray->Clear(); //Variables declaration Int_t clustsize_front, clustsize_back; Double_t Q_r_front , Q_l_front, RecoCharge_front; Double_t Q_r_back , Q_l_back, RecoCharge_back; TString detname; TGeoHMatrix transMatrix ; TVector3 offset ; Int_t nhits; Double_t recoY_strip_front, recoPos_st_front; Double_t recoY_strip_back, recoPos_st_back; TVector3 MCPos_strip_front, RecoPosition_front; TVector3 MCPos_strip_back, RecoPosition_back; TVector3 MCPosition, RecoPosition; FairGeoVector RecoPos_strip_front, RecoPos_strip_back; TVector3 loc_front, Loc_front; TVector3 loc_back, Loc_back; Double_t zeroId_front, zeroId_back; // Loop over PndLumiCluster Int_t nClusters = fLumiClusterArrayFront->GetEntriesFast(); for (Int_t iCluster = 0; iCluster < nClusters; iCluster++){ cout << "iCluster : "<< iCluster<At(iCluster); PndLumiCluster *ClusterBack = (PndLumiCluster*) fLumiClusterArrayBack->At(iCluster); //** Get information from cluster // For both sides transMatrix = ClusterFront->GetTransformationMatrix(); //transMatrix.Print(""); offset = ClusterFront->GetSensorDimension(); detname = ClusterFront->GetDetName(); cout << detname <GetMCPosition(); nhits = ClusterFront->GetHitNumber(); // For front side only clustsize_front = ClusterFront->GetClusterSize(); zeroId_front = ClusterFront->GetStripZeroId(); //cout << " Size ="<< clustsize_front <GetRightCharge(); Q_l_front = ClusterFront->GetLeftCharge(); MCPos_strip_front = ClusterFront->GetStripPosition(); //cout << "A :" << MCPos_strip_front.X()<< " , "<GetClusterSize(); zeroId_back = ClusterBack->GetStripZeroId(); Q_r_back = ClusterBack->GetRightCharge(); Q_l_back = ClusterBack->GetLeftCharge(); MCPos_strip_back = ClusterBack->GetStripPosition(); /***************************************************** * DO RECONSTRUCTION * ****************************************************/ // **** For FRONT side only // y-position reconstructed in strip coord syst RecoCharge_front = Q_r_front + Q_l_front; if (clustsize_front == 1){ //recoPos_st_front = MCPos_strip_front.Y(); recoPos_st_front = 0.5*fPitch; recoY_strip_front = ((ClusterFront->GetLeftId()-zeroId_front) * fPitch )+ recoPos_st_front; }else{ recoPos_st_front = SmearPosition(Q_r_front/ RecoCharge_front); recoY_strip_front = (ClusterFront->GetRightId()-zeroId_front) * fPitch + recoPos_st_front; } // Get local hit position reconstructed in strip coord syst Double_t local_front[3], global_front[3]; RecoPos_strip_front.setXYZ(MCPos_strip_front.X(), recoY_strip_front, MCPos_strip_front.Z()); cout << "RecoPos_strip_front :"<GetLeftId()) * fPitch + recoPos_st_back; }else{ recoPos_st_back = SmearPosition(Q_r_back/ RecoCharge_back); recoY_strip_back = (ClusterBack->GetRightId()) * fPitch + recoPos_st_back; } // Get local hit position reconstructed in strip coord syst Double_t local_back[3], global_back[3]; RecoPos_strip_back.setXYZ(MCPos_strip_back.X(), recoY_strip_back, MCPos_strip_back.Z()); loc_back = StripDirtoLoc(((TMath::Pi()/2)-fOrient), RecoPos_strip_back);//inverse Loc_back.SetX( loc_back.X() - offset.X() ); Loc_back.SetY( loc_back.Y() - offset.Y() ); Loc_back.SetZ( loc_back.Z() - offset.Z() ); local_back[0] = Loc_back.X(); local_back[1] = Loc_back.Y(); local_back[2] = Loc_back.Z(); // Get global hit position reconstructed transMatrix.LocalToMaster(local_back , global_back); RecoPosition_back.SetXYZ(global_back[0], global_back[1], global_back[2]); RecoPosition = 0.5*(RecoPosition_front + RecoPosition_back); //cout << "MC : ( "<< MCPosition.X() <<" , " <