diff --git a/Trigger/TrigFTK/FTK_DataProviderSvc/FTK_DataProviderSvc/FTK_DataProviderSvc.h b/Trigger/TrigFTK/FTK_DataProviderSvc/FTK_DataProviderSvc/FTK_DataProviderSvc.h index 75f1697ef9d14bb0dab52b33adf57afd052ef2ed..afe507c141bc7b255bc5bcef6d5de841a1b1ed2e 100644 --- a/Trigger/TrigFTK/FTK_DataProviderSvc/FTK_DataProviderSvc/FTK_DataProviderSvc.h +++ b/Trigger/TrigFTK/FTK_DataProviderSvc/FTK_DataProviderSvc/FTK_DataProviderSvc.h @@ -260,6 +260,8 @@ class FTK_DataProviderSvc : public virtual IFTK_DataProviderSvc, virtual public std::vector<unsigned int> m_nMissingSCTClusters; std::vector<unsigned int> m_nMissingPixelClusters; + bool m_reverseIBLlocx; + }; inline bool compareFTK_Clusters (const Trk::RIO_OnTrack* cl1, const Trk::RIO_OnTrack* cl2) { diff --git a/Trigger/TrigFTK/FTK_DataProviderSvc/src/FTK_DataProviderSvc.cxx b/Trigger/TrigFTK/FTK_DataProviderSvc/src/FTK_DataProviderSvc.cxx index b5cd8aaef71d3ba2b93155e867f4ed2b98869a70..0d8acecf02583aff930687157e1c725c48a15283 100644 --- a/Trigger/TrigFTK/FTK_DataProviderSvc/src/FTK_DataProviderSvc.cxx +++ b/Trigger/TrigFTK/FTK_DataProviderSvc/src/FTK_DataProviderSvc.cxx @@ -151,7 +151,8 @@ FTK_DataProviderSvc::FTK_DataProviderSvc(const std::string& name, ISvcLocator* s m_rejectBadTracks(false), m_dPhiCut(0.4), m_dEtaCut(0.6), - m_nErrors(0) + m_nErrors(0), + m_reverseIBLlocx(false) { m_pixelBarrelPhiOffsets.reserve(4); m_pixelBarrelEtaOffsets.reserve(4); @@ -213,6 +214,7 @@ FTK_DataProviderSvc::FTK_DataProviderSvc(const std::string& name, ISvcLocator* s declareProperty("setBroadPixelClusterOnTrackErrors",m_broadPixelErrors); declareProperty("setBroadSCT_ClusterOnTrackErrors",m_broadSCT_Errors); declareProperty("RemoveDuplicates",m_remove_duplicates); + declareProperty("ReverseIBLlocX",m_reverseIBLlocx, "reverse the direction of IBL locX from FTK"); } @@ -301,7 +303,7 @@ StatusCode FTK_DataProviderSvc::initialize() { ATH_MSG_INFO( " Pixel Barrel Eta Offsets (pixels): " << m_pixelBarrelEtaOffsets); ATH_MSG_INFO( " Pixel EndCap Phi Offsets (pixels): " << m_pixelEndCapPhiOffsets); ATH_MSG_INFO( " Pixel EndCap Eta Offsets (pixels): " << m_pixelEndCapEtaOffsets); - + if (m_reverseIBLlocx) ATH_MSG_INFO( "Reversing the direction of IBL LocX"); if (m_correctPixelClusters) { ATH_MSG_INFO( " applying all corrections (lorentz, angle, sag) to Pixel Clusters on converted tracks using RotCreatorTool"); @@ -1789,7 +1791,14 @@ const Trk::RIO_OnTrack* FTK_DataProviderSvc::createPixelCluster(const FTK_RawPi ATH_MSG_VERBOSE( " Module rows= " << design->rows() << " phiPitch= " << design->phiPitch() << " width= " << design->width() ); ATH_MSG_VERBOSE( " columns = " << design->columns() << " etaPitch= " << design->etaPitch() << " length " << design->length()); - int rawLocalPhiCoord = raw_pixel_cluster.getRowCoord(); + int rawLocalPhiCoord; + + if (m_reverseIBLlocx && isBarrel && layer==0) { + rawLocalPhiCoord = 2680 - raw_pixel_cluster.getRowCoord(); //335*8=2680 + } else { + rawLocalPhiCoord = raw_pixel_cluster.getRowCoord(); + } + int rawLocalEtaCoord= raw_pixel_cluster.getColCoord(); const InDetDD::SiCellId cornerCell(0, 0); @@ -1799,6 +1808,8 @@ const Trk::RIO_OnTrack* FTK_DataProviderSvc::createPixelCluster(const FTK_RawPi ATH_MSG_VERBOSE( " local position of pixel at (0,0) is "<< phi0 << ", " << eta0); + + // zero is center of the row coordinates, so to find the cell we can use it, units of 6.25 microns // zero is edge of the column coordinates, so to find the cell we add 0.5, units of 25 microns double phiPos = ((double) rawLocalPhiCoord) * 6.25e-3 + phi0; // rawLocalPhiCoord=0 is the centre of the zeroth pixel diff --git a/Trigger/TrigFTK/TrigFTK_RawDataAlgs/TrigFTK_RawDataAlgs/FTK_RDO_CreatorAlgo.h b/Trigger/TrigFTK/TrigFTK_RawDataAlgs/TrigFTK_RawDataAlgs/FTK_RDO_CreatorAlgo.h index 4e457673a825a122542a66b1993b694deb12535e..9d69e057c93aa64c44ab1560885479775430bb7a 100644 --- a/Trigger/TrigFTK/TrigFTK_RawDataAlgs/TrigFTK_RawDataAlgs/FTK_RDO_CreatorAlgo.h +++ b/Trigger/TrigFTK/TrigFTK_RawDataAlgs/TrigFTK_RawDataAlgs/FTK_RDO_CreatorAlgo.h @@ -91,6 +91,7 @@ private: double m_trainingBeamspotZ; double m_trainingBeamspotTiltX; double m_trainingBeamspotTiltY; + bool m_reverseIBLlocx; // Convertor for RDO objects FTK_RawTrack* SimToRaw(const FTKTrack&); diff --git a/Trigger/TrigFTK/TrigFTK_RawDataAlgs/src/FTK_RDO_CreatorAlgo.cxx b/Trigger/TrigFTK/TrigFTK_RawDataAlgs/src/FTK_RDO_CreatorAlgo.cxx index 58b7829f6f3d9e5864353fc7045fe7b30b42ae90..442615728ef35278af7751950272e9c54954ef08 100644 --- a/Trigger/TrigFTK/TrigFTK_RawDataAlgs/src/FTK_RDO_CreatorAlgo.cxx +++ b/Trigger/TrigFTK/TrigFTK_RawDataAlgs/src/FTK_RDO_CreatorAlgo.cxx @@ -54,7 +54,8 @@ FTK_RDO_CreatorAlgo::FTK_RDO_CreatorAlgo(const std::string& name, ISvcLocator* p m_trainingBeamspotX(0.), m_trainingBeamspotY(0.), m_trainingBeamspotTiltX(0.), - m_trainingBeamspotTiltY(0.) + m_trainingBeamspotTiltY(0.), + m_reverseIBLlocx(false) { declareProperty("mergedTrackPaths",m_ftktrack_paths_merged, "Paths of the merged tracks"); @@ -64,6 +65,7 @@ FTK_RDO_CreatorAlgo::FTK_RDO_CreatorAlgo(const std::string& name, ISvcLocator* p declareProperty("TrainingBeamspotY", m_trainingBeamspotY); declareProperty("TrainingBeamspotTiltX", m_trainingBeamspotTiltX); declareProperty("TrainingBeamspotTiltY", m_trainingBeamspotTiltY); + declareProperty("ReverseIBLlocX",m_reverseIBLlocx, "reverse the direction of IBL locX from FTK"); m_FTK_RawTrack_checkFails.reserve(9); m_FTK_RawSCT_Cluster_checkFails.reserve(5); @@ -81,19 +83,20 @@ FTK_RDO_CreatorAlgo::~FTK_RDO_CreatorAlgo() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * StatusCode FTK_RDO_CreatorAlgo::initialize(){ MsgStream log(msgSvc(), name()); - log << MSG::INFO << "FTK_RDO_CreatorAlgo::initialize()" << endmsg; + ATH_MSG_INFO("FTK_RDO_CreatorAlgo::initialize()"); - log << MSG::VERBOSE << "mergedTrackPaths: "<<m_ftktrack_paths_merged<< - "Paths of the merged tracks: "<< endmsg; - log << MSG::VERBOSE << "mergeTrackBName: "<<m_mergedtracks_bname<<" - Branch name for the merged tracks"<< endmsg; - - log << MSG::INFO << "Correcting for FTK training beamspot at x " << m_trainingBeamspotX <<" y " << m_trainingBeamspotY - << " z " << m_trainingBeamspotZ << " TiltX " << m_trainingBeamspotTiltX << "TiltY " << m_trainingBeamspotTiltY << endmsg; + ATH_MSG_VERBOSE("mergedTrackPaths: "<<m_ftktrack_paths_merged<< + "Paths of the merged tracks: "); + ATH_MSG_VERBOSE("mergeTrackBName: "<<m_mergedtracks_bname<<" - Branch name for the merged tracks"); + + ATH_MSG_INFO("Correcting for FTK training beamspot at x " << m_trainingBeamspotX <<" y " << m_trainingBeamspotY + << " z " << m_trainingBeamspotZ << " TiltX " << m_trainingBeamspotTiltX << "TiltY " << m_trainingBeamspotTiltY); + if (m_reverseIBLlocx)ATH_MSG_INFO(" Reversing direction of IBL hit phi position"); StatusCode scSG = service( "StoreGateSvc", m_StoreGate ); if (scSG.isFailure()) { - log << MSG::FATAL << "Unable to retrieve StoreGate service" << endmsg; + ATH_MSG_FATAL("Unable to retrieve StoreGate service"); return scSG; } @@ -108,17 +111,17 @@ StatusCode FTK_RDO_CreatorAlgo::initialize(){ // prepare the input from the FTK tracks, merged in an external simulation m_mergedtracks_chain = new TChain("ftkdata","Merged tracks chain"); // add the file to the chain - log << MSG::INFO << "Loading " << m_ftktrack_paths_merged.size() << " files with FTK merged tracks" << endmsg; + ATH_MSG_INFO("Loading " << m_ftktrack_paths_merged.size() << " files with FTK merged tracks" ); vector<string>::const_iterator imtp = m_ftktrack_paths_merged.begin(); for (;imtp!=m_ftktrack_paths_merged.end();++imtp) { Int_t addres = m_mergedtracks_chain->Add((*imtp).c_str()); - log << MSG::DEBUG << "Added: " << *imtp << '[' << addres << ']' <<endmsg; + ATH_MSG_DEBUG("Added: " << *imtp << '[' << addres << ']'); } m_mergedtracks_stream = new FTKTrackStream(); TBranch *mergedtracks_branch; Int_t res = m_mergedtracks_chain->SetBranchAddress(m_mergedtracks_bname.c_str(),&m_mergedtracks_stream,&mergedtracks_branch); if (res<0) { - log << MSG::FATAL << "Branch \"" << m_mergedtracks_bname << "\" with merged tracks not found" << endmsg; + ATH_MSG_FATAL("Branch \"" << m_mergedtracks_bname << "\" with merged tracks not found" ); return StatusCode::FAILURE; } @@ -146,24 +149,24 @@ StatusCode FTK_RDO_CreatorAlgo::initialize(){ prevEventNumber = eventNumber; } else { - log << MSG::FATAL << "A duplicated event was found before the end of file, the error cannot be recoverd" << endmsg; + ATH_MSG_FATAL("A duplicated event was found before the end of file, the error cannot be recoverd" ); return StatusCode::FAILURE; } } else if (eventNumber==prevEventNumber) { - log << MSG::WARNING << "Event " << eventNumber << " found in the previous event, failure condition masked if this happens at the end of the file" << endmsg; + ATH_MSG_WARNING("Event " << eventNumber << " found in the previous event, failure condition masked if this happens at the end of the file" ); hasRepeatedEvents = true; } else { // Duplicate events are a condition error at the moment, this // can be fixed using a runNumber and eventNumber paier as key - log << MSG::FATAL << "Tracks for the current event (" << eventNumber << ") already exist. Duplication not allowed" << endmsg; + ATH_MSG_FATAL("Tracks for the current event (" << eventNumber << ") already exist. Duplication not allowed" ); return StatusCode::FAILURE; } } - log << MSG::DEBUG << "Tracks from " << m_trackVectorMap.size() << " events loaded"<<endmsg; + ATH_MSG_DEBUG("Tracks from " << m_trackVectorMap.size() << " events loaded"); return StatusCode::SUCCESS; } @@ -171,37 +174,37 @@ StatusCode FTK_RDO_CreatorAlgo::initialize(){ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * StatusCode FTK_RDO_CreatorAlgo::execute() { MsgStream log(msgSvc(), name()); - log << MSG::DEBUG << "FTK_RDO_CreatorAlgo::execute() start" << endmsg; + ATH_MSG_DEBUG("FTK_RDO_CreatorAlgo::execute() start" ); // Get information on the events const EventInfo* eventInfo(0); if( m_StoreGate->retrieve(eventInfo).isFailure() ) { - log << MSG::ERROR << "Could not retrieve event info" << endmsg; + ATH_MSG_ERROR("Could not retrieve event info" ); return StatusCode::FAILURE; } const EventID* eventID( eventInfo->event_ID() ); int eventNumber = eventID->event_number(); - log << MSG::DEBUG - << "entered execution for run " << eventID->run_number() - << " event " << eventNumber - << endmsg; + ATH_MSG_DEBUG( + "entered execution for run " << eventID->run_number() + << " event " << eventNumber + ); // Extract the vector of tracks found by the FTK for the current event std::map<int, Long64_t >::iterator mapIt = m_trackVectorMap.find(eventNumber); if(mapIt == m_trackVectorMap.end()) { - log << MSG::ERROR << "No FTK tracks for event " << eventNumber << " found, possible mismatch between RDO and FTK files"<<endmsg; + ATH_MSG_ERROR("No FTK tracks for event " << eventNumber << " found, possible mismatch between RDO and FTK files"); return StatusCode::FAILURE; } //Have Tracks const Long64_t &FTKEntry = (*mapIt).second; if (m_mergedtracks_chain->GetEntry(FTKEntry)==-1) { - log << MSG::ERROR << "Error reading the FTK entry: " << FTKEntry <<endmsg; + ATH_MSG_ERROR("Error reading the FTK entry: " << FTKEntry); return StatusCode::FAILURE; } int ntracks_merged = m_mergedtracks_stream->getNTracks(); - log << MSG::DEBUG << "Number of FTK tracks to merge in SG: " << ntracks_merged << endmsg; + ATH_MSG_DEBUG("Number of FTK tracks to merge in SG: " << ntracks_merged ); @@ -209,10 +212,10 @@ StatusCode FTK_RDO_CreatorAlgo::execute() { StatusCode scJ = m_StoreGate->record(m_ftk_raw_trackcollection, m_ftk_raw_trackcollection_Name); if (scJ.isFailure()) { - log << MSG::FATAL << "Failure registering FTK_RawTrackContainer" << endmsg; + ATH_MSG_FATAL("Failure registering FTK_RawTrackContainer" ); return StatusCode::FAILURE; } else{ - log << MSG::DEBUG << "Setting FTK_RawTrackContainer registered" << endmsg; + ATH_MSG_DEBUG("Setting FTK_RawTrackContainer registered" ); } // @@ -233,7 +236,7 @@ StatusCode FTK_RDO_CreatorAlgo::execute() { // prepare to move to the next event m_mergedtracks_iev += 1; - log << MSG::DEBUG << "FTK_RDO_CreatorAlgo::execute() end" << endmsg; + ATH_MSG_DEBUG("FTK_RDO_CreatorAlgo::execute() end" ); return StatusCode::SUCCESS; } @@ -241,7 +244,7 @@ StatusCode FTK_RDO_CreatorAlgo::execute() { // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * StatusCode FTK_RDO_CreatorAlgo::finalize() { MsgStream log(msgSvc(), name()); - log << MSG::INFO << "finalize()" << endmsg; + ATH_MSG_INFO("finalize()" ); // // Clean up output and input merged files @@ -276,10 +279,10 @@ StatusCode FTK_RDO_CreatorAlgo::finalize() { // cleanup the map containing the list of FTK tracks found in each event - log << MSG::DEBUG << "Clear Track map" << endmsg; + ATH_MSG_DEBUG("Clear Track map" ); m_trackVectorMap.clear(); - log << MSG::DEBUG << "end Finalize() " << endmsg; + ATH_MSG_DEBUG("end Finalize() " ); return StatusCode::SUCCESS; } @@ -332,11 +335,21 @@ FTK_RawTrack* FTK_RDO_CreatorAlgo::SimToRaw(const FTKTrack &track) valid = false; } ATH_MSG_VERBOSE( " Creating Pixel cluster for layer " << iPlane); - //Identifier wafer_id = m_pixelId->wafer_id(hitHashId); + float phi_index= hit.getHwCoord(0); float eta_index = hit.getHwCoord(1); + if (m_reverseIBLlocx) { + Identifier wafer_id = m_pixelId->wafer_id(hitHashId); + bool isBarrel = (m_pixelId->barrel_ec(wafer_id)==0); + unsigned int layer = m_pixelId->layer_disk(wafer_id); + + if (isBarrel && layer==0) { + phi_index = 2680. - phi_index; //335*8=2680 + } + } + // if (phi_index > m_pixelId->phi_index_max(wafer_id)){ //ATH_MSG_INFO( " Invalid Pixel phi_index " << phi_index << " max phi index " << m_pixelId->phi_index_max(wafer_id) << " and original value before scaling = " << hit.getHwCoord(0)); //valid = false; @@ -469,7 +482,7 @@ void FTK_RDO_CreatorAlgo::printTrack(const FTKTrack& track, const FTK_RawTrack * " invPt= " << raw_track->getInvPt() << " chi2= " << raw_track->getChi2() << " barcode= " << raw_track->getBarcode()<< - " layermap bits: "; + " layermap bits: "<<std::endl; this->printBits(raw_track->getLayerMap() ,12); std::cout << std::endl; std::cout << "FTKTRack: "<< @@ -545,8 +558,6 @@ void FTK_RDO_CreatorAlgo::printTrack(const FTKTrack& track, const FTK_RawTrack * std::cout << std::endl; } - -bool FTK_RDO_CreatorAlgo::check_track(const FTKTrack &track, FTK_RawTrack &rdo) { #define d0Res 0.001 #define z0Res 0.01 #define phiRes 0.0001 @@ -557,6 +568,8 @@ bool FTK_RDO_CreatorAlgo::check_track(const FTKTrack &track, FTK_RawTrack &rdo) #define pixColRes 0.1 #define pixRowRes 0.1 +bool FTK_RDO_CreatorAlgo::check_track(const FTKTrack &track, FTK_RawTrack &rdo) { + bool check_ok= true; if (!(this->checkInt(track.getRoadID(), rdo.getRoadID(), "RoadID"))) { m_FTK_RawTrack_checkFails[8]+=1; check_ok=false; @@ -625,7 +638,19 @@ bool FTK_RDO_CreatorAlgo::check_track(const FTKTrack &track, FTK_RawTrack &rdo) if (!(this->checkInt(hit.getIdentifierHash(), rdo.getPixelClusters()[i].getModuleID(), "Pixel moduleID"))){ m_FTK_RawPixelCluster_checkFails[0]+=1;hitOK=false; } - if (!(this->checkValue(hit.getHwCoord(0), rdo.getPixelClusters()[i].getRowCoord(),pixRowRes,"Pixel Row"))){ + + float phi_index= hit.getHwCoord(0); + + if (m_reverseIBLlocx) { + Identifier wafer_id = m_pixelId->wafer_id(hit.getIdentifierHash()); + bool isBarrel = (m_pixelId->barrel_ec(wafer_id)==0); + unsigned int layer = m_pixelId->layer_disk(wafer_id); + + if (isBarrel && layer==0) { + phi_index = 2680 - phi_index; //335*8=2680 + } + } + if (!(this->checkValue(phi_index, rdo.getPixelClusters()[i].getRowCoord(),pixRowRes,"Pixel Row"))){ m_FTK_RawPixelCluster_checkFails[1]+=1;hitOK=false; } if (!(this->checkValue(hit.getHwCoord(1), rdo.getPixelClusters()[i].getColCoord(),pixColRes,"Pixel Column"))){ @@ -694,7 +719,7 @@ void FTK_RDO_CreatorAlgo::printBits(unsigned int num, unsigned int length){ unsigned int bit=length; for(unsigned int i=0; i<length; i++){ bit--; - std::cout << int( (num & (0x1<<bit))>>bit); + std::cout << int( (num & (0x1<<bit))>>bit)<<std::endl; } }