Public Types | |
typedef std::vector< L1TkStubType > | L1TkStubCollectionType |
typedef std::vector < L1TkStubPtrType > | L1TkStubPtrCollection |
typedef std::vector < L1TkStubPtrCollection > | L1TkStubPtrCollVectorType |
typedef edm::Ptr< L1TkStubType > | L1TkStubPtrType |
typedef L1TkStub_PixelDigi_ | L1TkStubType |
typedef std::vector < L1TkTrackType > | L1TkTrackCollectionType |
typedef L1TkTrack_PixelDigi_ | L1TkTrackType |
typedef std::vector< L1TTrack > | L1TrackCollectionType |
Public Member Functions | |
L1TrackProducer (const edm::ParameterSet &iConfig) | |
Constructor/destructor. | |
virtual | ~L1TrackProducer () |
Private Member Functions | |
virtual void | beginRun (edm::Run &run, const edm::EventSetup &iSetup) |
virtual void | endRun (edm::Run &run, const edm::EventSetup &iSetup) |
virtual void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
Private Attributes | |
edm::ParameterSet | config |
Containers of parameters passed by python configuration file. | |
int | eventnum |
GeometryMap | geom |
string | geometry_ |
Definition at line 139 of file L1TrackProducer.cc.
typedef std::vector< L1TkStubType > L1TrackProducer::L1TkStubCollectionType |
Definition at line 144 of file L1TrackProducer.cc.
typedef std::vector< L1TkStubPtrType > L1TrackProducer::L1TkStubPtrCollection |
Definition at line 146 of file L1TrackProducer.cc.
typedef std::vector< L1TkStubPtrCollection > L1TrackProducer::L1TkStubPtrCollVectorType |
Definition at line 147 of file L1TrackProducer.cc.
typedef edm::Ptr< L1TkStubType > L1TrackProducer::L1TkStubPtrType |
Definition at line 145 of file L1TrackProducer.cc.
Definition at line 143 of file L1TrackProducer.cc.
typedef std::vector< L1TkTrackType > L1TrackProducer::L1TkTrackCollectionType |
Definition at line 154 of file L1TrackProducer.cc.
Definition at line 153 of file L1TrackProducer.cc.
typedef std::vector< L1TTrack > L1TrackProducer::L1TrackCollectionType |
Definition at line 155 of file L1TrackProducer.cc.
L1TrackProducer::L1TrackProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Constructor/destructor.
Definition at line 182 of file L1TrackProducer.cc.
References edm::ParameterSet::getUntrackedParameter().
{ //produces<L1TrackCollectionType>( "Level1Tracks" ).setBranchAlias("Level1Tracks"); produces< L1TkStubPtrCollVectorType >( "L1TkStubs" ).setBranchAlias("L1TkStubs"); produces< L1TkTrackCollectionType >( "Level1TkTracks" ).setBranchAlias("Level1TkTracks"); // produces<L1TkStubMapType>( "L1TkStubMap" ).setBranchAlias("L1TkStubMap"); // produces< L1TkTrackletCollectionType >( "L1TkTracklets" ).setBranchAlias("L1TkTracklets"); geometry_ = iConfig.getUntrackedParameter<string>("geometry",""); }
L1TrackProducer::~L1TrackProducer | ( | ) | [virtual] |
Insert here what you need to delete when you close the class instance
Definition at line 195 of file L1TrackProducer.cc.
{ }
void L1TrackProducer::beginRun | ( | edm::Run & | run, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
///////////////// /// MANDATORY METHODS ///
Reimplemented from edm::EDProducer.
Definition at line 211 of file L1TrackProducer.cc.
References gather_cfg::cout.
void L1TrackProducer::endRun | ( | edm::Run & | run, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Things to be done at the exit of the event Loop
Reimplemented from edm::EDProducer.
Definition at line 203 of file L1TrackProducer.cc.
{ }
void L1TrackProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Prepare output
Geometry handles etc
Geometry setup Set pointers to Geometry
Set pointers to Stacked Modules
Note this is different from the "global" geometry
LOOP OVER SimTracks
Get the corresponding vertex
End of Loop over SimTracks
Build Detector Id
Check if it is Pixel
Renormalize layer number from 5-14 to 0-9 and skip if inner pixels
Loop over PixelDigis within Module and select those above threshold
Threshold (here it is NOT redundant)
Try to learn something from PixelDigi position
Loop over PixelDigiSimLink to find the correct link to the SimTrack collection
When the channel is the same, the link is found
Map wrt SimTrack Id
Get the PixelDigiSimLink corresponding to this one
Renormalize layer number from 5-14 to 0-9 and skip if inner pixels
Loop over PixelDigis within Module and select those above threshold
Threshold (here it is NOT redundant)
Try to learn something from PixelDigi position
Loop over PixelDigiSimLink to find the correct link to the SimTrack collection
When the channel is the same, the link is found
Map wrt SimTrack Id
Loop over L1TkStubs
Get the Inner and Outer L1TkCluster
Implements edm::EDProducer.
Definition at line 219 of file L1TrackProducer.cc.
References edm::DetSetVector< T >::begin(), PXFDetId::blade(), PixelChannelIdentifier::channelToPixel(), gather_cfg::cout, edm::DetSet< T >::data, PXFDetId::disk(), edm::DetSetVector< T >::end(), StackedTrackerGeometry::findGlobalPosition(), StackedTrackerGeometry::findRoughPt(), edm::EventSetup::get(), edm::Event::getByLabel(), StackedTrackerGeometry::idToDet(), TrackerGeometry::idToDetUnit(), StackedTrackerDetId::iLayer(), MagneticField::inTesla(), StackedTrackerDetId::iPhi(), StackedTrackerDetId::iRing(), StackedTrackerDetId::iZ(), PXBDetId::ladder(), PXBDetId::layer(), Topology::localPosition(), alignBH_cfg::mode, PXFDetId::module(), PXBDetId::module(), python::rootplot::argparse::module, evf::evtn::offset(), PXFDetId::panel(), CoreSimVertex::position(), edm::ESHandle< T >::product(), edm::DetSet< T >::push_back(), edm::Event::put(), DetId::rawId(), L1TkTrack< T >::setMomentum(), PXFDetId::side(), DetId::subdetId(), GeomDet::surface(), Surface::toGlobal(), GeomDetUnit::topology(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ typedef std::map< L1TStub, L1TkStubPtrType, L1TStubCompare > stubMapType; //std::auto_ptr< L1TrackCollectionType > L1TracksForOutput( new L1TrackCollectionType ); std::auto_ptr< L1TkStubPtrCollVectorType > L1TkStubsForOutput( new L1TkStubPtrCollVectorType ); //std::auto_ptr< L1TkTrackletCollectionType > L1TkTrackletsForOutput( new L1TkTrackletCollectionType ); std::auto_ptr< L1TkTrackCollectionType > L1TkTracksForOutput( new L1TkTrackCollectionType ); edm::ESHandle<TrackerGeometry> geometryHandle; const TrackerGeometry* theGeometry; edm::ESHandle<StackedTrackerGeometry> stackedGeometryHandle; const StackedTrackerGeometry* theStackedGeometry; StackedTrackerGeometry::StackContainerIterator StackedTrackerIterator; iSetup.get<TrackerDigiGeometryRecord>().get(geometryHandle); theGeometry = &(*geometryHandle); iSetup.get<StackedTrackerGeometryRecord>().get(stackedGeometryHandle); theStackedGeometry = stackedGeometryHandle.product(); // GET MAGNETIC FIELD // edm::ESHandle<MagneticField> magneticFieldHandle; iSetup.get<IdealMagneticFieldRecord>().get(magneticFieldHandle); const MagneticField* theMagneticField = magneticFieldHandle.product(); double mMagneticFieldStrength = theMagneticField->inTesla(GlobalPoint(0,0,0)).z(); // GET BS // edm::Handle<reco::BeamSpot> recoBeamSpotHandle; iEvent.getByLabel("BeamSpotFromSim","BeamSpot",recoBeamSpotHandle); math::XYZPoint bsPosition=recoBeamSpotHandle->position(); cout << "L1TrackProducer: B="<<mMagneticFieldStrength <<" vx reco="<<bsPosition.x() <<" vy reco="<<bsPosition.y() <<" vz reco="<<bsPosition.z() <<endl; SLHCEvent ev; ev.setIPx(bsPosition.x()); ev.setIPy(bsPosition.y()); eventnum++; cout << "Get simtracks"<<endl; // GET SIMTRACKS // edm::Handle<edm::SimTrackContainer> simTrackHandle; edm::Handle<edm::SimVertexContainer> simVtxHandle; //iEvent.getByLabel( "famosSimHits", simTrackHandle ); //iEvent.getByLabel( "famosSimHits", simVtxHandle ); iEvent.getByLabel( "g4SimHits", simTrackHandle ); iEvent.getByLabel( "g4SimHits", simVtxHandle ); // GET MC PARTICLES // edm::Handle<reco::GenParticleCollection> genpHandle; iEvent.getByLabel( "genParticles", genpHandle ); cout << "Get pixel digis"<<endl; // GET PIXEL DIGIS // edm::Handle<edm::DetSetVector<PixelDigi> > pixelDigiHandle; edm::Handle<edm::DetSetVector<PixelDigiSimLink> > pixelDigiSimLinkHandle; iEvent.getByLabel("simSiPixelDigis", pixelDigiHandle); iEvent.getByLabel("simSiPixelDigis", pixelDigiSimLinkHandle); cout << "Get stubs and clusters"<<endl; // GET THE PRIMITIVES // edm::Handle<L1TkCluster_PixelDigi_Collection> pixelDigiL1TkClusterHandle; edm::Handle<L1TkStub_PixelDigi_Collection> pixelDigiL1TkStubHandle; iEvent.getByLabel("L1TkClustersFromPixelDigis", pixelDigiL1TkClusterHandle); iEvent.getByLabel("L1TkStubsFromPixelDigis", "StubsPass", pixelDigiL1TkStubHandle); cout << "Will loop over simtracks" <<endl; SimTrackContainer::const_iterator iterSimTracks; for ( iterSimTracks = simTrackHandle->begin(); iterSimTracks != simTrackHandle->end(); ++iterSimTracks ) { int vertexIndex = iterSimTracks->vertIndex(); const SimVertex& theSimVertex = (*simVtxHandle)[vertexIndex]; math::XYZTLorentzVectorD trkVtxPos = theSimVertex.position(); GlobalPoint trkVtxCorr = GlobalPoint( trkVtxPos.x() - bsPosition.x(), trkVtxPos.y() - bsPosition.y(), trkVtxPos.z() - bsPosition.z() ); double pt=iterSimTracks->momentum().pt(); if (pt!=pt) pt=9999.999; ev.addL1SimTrack(iterSimTracks->trackId(),iterSimTracks->type(),pt, iterSimTracks->momentum().eta(), iterSimTracks->momentum().phi(), trkVtxCorr.x(), trkVtxCorr.y(), trkVtxCorr.z()); } std::cout << "Will loop over digis:"<<std::endl; DetSetVector<PixelDigi>::const_iterator iterDet; for ( iterDet = pixelDigiHandle->begin(); iterDet != pixelDigiHandle->end(); iterDet++ ) { DetId tkId( iterDet->id ); StackedTrackerDetId stdetid(tkId); if ( tkId.subdetId() == 2 ) { PXFDetId pxfId(tkId); DetSetVector<PixelDigiSimLink>::const_iterator itDigiSimLink1=pixelDigiSimLinkHandle->find(pxfId.rawId()); if (itDigiSimLink1!=pixelDigiSimLinkHandle->end()){ DetSet<PixelDigiSimLink> digiSimLink = *itDigiSimLink1; //DetSet<PixelDigiSimLink> digiSimLink = (*pixelDigiSimLinkHandle)[ pxfId.rawId() ]; DetSet<PixelDigiSimLink>::const_iterator iterSimLink; int disk = pxfId.disk(); if (disk<4) { continue; } disk-=3; // Layer 0-20 //DetId digiDetId = iterDet->id; //int sensorLayer = 0.5*(2*PXFDetId(digiDetId).layer() + (PXFDetId(digiDetId).ladder() + 1)%2 - 8); DetSet<PixelDigi>::const_iterator iterDigi; for ( iterDigi = iterDet->data.begin(); iterDigi != iterDet->data.end(); iterDigi++ ) { if ( iterDigi->adc() <= 30 ) continue; const GeomDetUnit* gDetUnit = theGeometry->idToDetUnit( tkId ); MeasurementPoint mp( iterDigi->row() + 0.5, iterDigi->column() + 0.5 ); GlobalPoint pdPos = gDetUnit->surface().toGlobal( gDetUnit->topology().localPosition( mp ) ) ; int offset=1000; if (pxfId.side()==1) { offset=2000; } assert(pxfId.panel()==1); vector<int> simtrackids; for ( iterSimLink = digiSimLink.data.begin(); iterSimLink != digiSimLink.data.end(); iterSimLink++) { if ( (int)iterSimLink->channel() == iterDigi->channel() ) { unsigned int simTrackId = iterSimLink->SimTrackId(); simtrackids.push_back(simTrackId); } } ev.addDigi(offset+disk,iterDigi->row(),iterDigi->column(), pxfId.blade(),pxfId.panel(),pxfId.module(), pdPos.x(),pdPos.y(),pdPos.z(),simtrackids); } } } if ( tkId.subdetId() == 1 ) { PXBDetId pxbId(tkId); DetSetVector<PixelDigiSimLink>::const_iterator itDigiSimLink=pixelDigiSimLinkHandle->find(pxbId.rawId()); if (itDigiSimLink==pixelDigiSimLinkHandle->end()){ continue; } DetSet<PixelDigiSimLink> digiSimLink = *itDigiSimLink; //DetSet<PixelDigiSimLink> digiSimLink = (*pixelDigiSimLinkHandle)[ pxbId.rawId() ]; DetSet<PixelDigiSimLink>::const_iterator iterSimLink; if ( pxbId.layer() < 5 ) { continue; } // Layer 0-20 DetId digiDetId = iterDet->id; int sensorLayer = 0.5*(2*PXBDetId(digiDetId).layer() + (PXBDetId(digiDetId).ladder() + 1)%2 - 8); DetSet<PixelDigi>::const_iterator iterDigi; for ( iterDigi = iterDet->data.begin(); iterDigi != iterDet->data.end(); iterDigi++ ) { if ( iterDigi->adc() <= 30 ) continue; const GeomDetUnit* gDetUnit = theGeometry->idToDetUnit( tkId ); MeasurementPoint mp( iterDigi->row() + 0.5, iterDigi->column() + 0.5 ); GlobalPoint pdPos = gDetUnit->surface().toGlobal( gDetUnit->topology().localPosition( mp ) ) ; vector<int > simtrackids; for ( iterSimLink = digiSimLink.data.begin(); iterSimLink != digiSimLink.data.end(); iterSimLink++) { if ( (int)iterSimLink->channel() == iterDigi->channel() ) { unsigned int simTrackId = iterSimLink->SimTrackId(); simtrackids.push_back(simTrackId); } } ev.addDigi(sensorLayer,iterDigi->row(),iterDigi->column(), pxbId.layer(),pxbId.ladder(),pxbId.module(), pdPos.x(),pdPos.y(),pdPos.z(),simtrackids); } } } cout << "Will loop over stubs" << endl; L1TkStub_PixelDigi_Collection::const_iterator iterL1TkStub; for ( iterL1TkStub = pixelDigiL1TkStubHandle->begin(); iterL1TkStub != pixelDigiL1TkStubHandle->end(); ++iterL1TkStub ) { double stubPt = theStackedGeometry->findRoughPt(mMagneticFieldStrength,&(*iterL1TkStub)); if (stubPt>10000.0) stubPt=9999.99; GlobalPoint stubPosition = theStackedGeometry->findGlobalPosition(&(*iterL1TkStub)); StackedTrackerDetId stubDetId = iterL1TkStub->getDetId(); unsigned int iStack = stubDetId.iLayer(); unsigned int iRing = stubDetId.iRing(); unsigned int iPhi = stubDetId.iPhi(); unsigned int iZ = stubDetId.iZ(); std::vector<bool> innerStack; std::vector<int> irphi; std::vector<int> iz; std::vector<int> iladder; std::vector<int> imodule; if (iStack==999999) { iStack=1000+iRing; } edm::Ptr<L1TkCluster_PixelDigi_> innerCluster = iterL1TkStub->getClusterPtr(0); const DetId innerDetId = theStackedGeometry->idToDet( innerCluster->getDetId(), 0 )->geographicalId(); for (unsigned int ihit=0;ihit<innerCluster->getHits().size();ihit++){ std::pair<int,int> rowcol=PixelChannelIdentifier::channelToPixel(innerCluster->getHits().at(ihit)->channel()); if (iStack<1000) { innerStack.push_back(true); irphi.push_back(rowcol.first); iz.push_back(rowcol.second); iladder.push_back(PXBDetId(innerDetId).ladder()); imodule.push_back(PXBDetId(innerDetId).module()); } else { innerStack.push_back(true); irphi.push_back(rowcol.first); iz.push_back(rowcol.second); iladder.push_back(PXFDetId(innerDetId).disk()); imodule.push_back(PXFDetId(innerDetId).module()); } } edm::Ptr<L1TkCluster_PixelDigi_> outerCluster = iterL1TkStub->getClusterPtr(1); const DetId outerDetId = theStackedGeometry->idToDet( outerCluster->getDetId(), 1 )->geographicalId(); for (unsigned int ihit=0;ihit<outerCluster->getHits().size();ihit++){ std::pair<int,int> rowcol=PixelChannelIdentifier::channelToPixel(outerCluster->getHits().at(ihit)->channel()); if (iStack<1000) { innerStack.push_back(false); irphi.push_back(rowcol.first); iz.push_back(rowcol.second); iladder.push_back(PXBDetId(outerDetId).ladder()); imodule.push_back(PXBDetId(outerDetId).module()); } else { innerStack.push_back(false); irphi.push_back(rowcol.first); iz.push_back(rowcol.second); iladder.push_back(PXFDetId(outerDetId).disk()); imodule.push_back(PXFDetId(outerDetId).module()); } } ev.addStub(iStack-1,iPhi,iZ,stubPt, stubPosition.x(),stubPosition.y(),stubPosition.z(), innerStack,irphi,iz,iladder,imodule); } std::cout << "Will actually do L1 tracking:"<<std::endl; // NOW RUN THE L1 tracking int mode = 0; // mode means: // 1 LB_6PS // 2 LB_4PS_2SS // 3 EB //cout << "geometry:"<<geometry_<<endl; if (geometry_=="LB_6PS") mode=1; if (geometry_=="LB_4PS_2SS") mode=2; if (geometry_=="BE") mode=3; assert(mode==1||mode==2||mode==3); #include "L1Tracking.icc" for (unsigned itrack=0; itrack<purgedTracks.size(); itrack++) { L1TTrack track=purgedTracks.get(itrack); //L1TkTrackType TkTrack(TkStubs, aSeedTracklet); L1TkTrackType TkTrack; //double frac; //TkTrack.setSimTrackId(track.simtrackid(frac)); FIXME //TkTrack.setRadius(1./track.rinv()); FIXME //GlobalPoint bsPosition(recoBeamSpotHandle->position().x(), // recoBeamSpotHandle->position().y(), // track.z0() // ); //store the L1 track vertex position GlobalPoint bsPosition(0.0, 0.0, track.z0() ); //store the L1 track vertex position //TkTrack.setVertex(bsPosition); FIXME //TkTrack.setChi2RPhi(track.chisq1()); FIXME //TkTrack.setChi2ZPhi(track.chisq2()); FIXME //cout << "L1TrackProducer Track with pt="<<track.pt(mMagneticFieldStrength)<<endl; TkTrack.setMomentum( GlobalVector ( GlobalVector::Cylindrical(fabs(track.pt(mMagneticFieldStrength)), track.phi0(), fabs(track.pt(mMagneticFieldStrength))*sinh(track.eta())) ) ); L1TkTracksForOutput->push_back(TkTrack); vector<L1TkStubPtrType> TkStubs; L1TTracklet tracklet = track.getSeed(); vector<L1TStub> stubComponents;// = tracklet.getStubComponents(); vector<L1TStub> stubs = track.getStubs(); //L1TkTrackletType TkTracklet; stubMapType::iterator it; //for (it = stubMap.begin(); it != stubMap.end(); it++) { //if (it->first == stubComponents[0] || it->first == stubComponents[1]) { //L1TkStubPtrType TkStub = it->second; //if (TkStub->getStack()%2 == 0) // TkTracklet.addStub(0, TkStub); //else // TkTracklet.addStub(1, TkStub); //} //for (int j=0; j<(int)stubs.size(); j++) { // if (it->first == stubs[j]) // TkStubs.push_back(it->second); //} //} L1TkStubsForOutput->push_back( TkStubs ); //TkTracklet.checkSimTrack(); //TkTracklet.fitTracklet(mMagneticFieldStrength, GlobalPoint(bsPosition.x(), bsPosition.y(), 0.0), true); //L1TkTrackletsForOutput->push_back( TkTracklet ); } // } iEvent.put( L1TkStubsForOutput, "L1TkStubs"); //iEvent.put( L1TkTrackletsForOutput, "L1TkTracklets" ); iEvent.put( L1TkTracksForOutput, "Level1TkTracks"); }
edm::ParameterSet L1TrackProducer::config [private] |
Containers of parameters passed by python configuration file.
Definition at line 168 of file L1TrackProducer.cc.
int L1TrackProducer::eventnum [private] |
Definition at line 165 of file L1TrackProducer.cc.
GeometryMap L1TrackProducer::geom [private] |
Definition at line 164 of file L1TrackProducer.cc.
string L1TrackProducer::geometry_ [private] |
Definition at line 170 of file L1TrackProducer.cc.