diff --git a/L1Trigger/TrackFindingTracklet/plugins/ProducerKFout.cc b/L1Trigger/TrackFindingTracklet/plugins/ProducerKFout.cc index 665bfe4a1ae67..327704175f01e 100644 --- a/L1Trigger/TrackFindingTracklet/plugins/ProducerKFout.cc +++ b/L1Trigger/TrackFindingTracklet/plugins/ProducerKFout.cc @@ -12,6 +12,7 @@ #include "L1Trigger/TrackTrigger/interface/Setup.h" #include "L1Trigger/TrackerTFP/interface/DataFormats.h" +#include "L1Trigger/TrackerTFP/interface/DistServer.h" #include #include @@ -32,6 +33,8 @@ namespace trackFindingTracklet { public: explicit ProducerKFout(const ParameterSet&); ~ProducerKFout() override {} + template + int digitise(const vector Bins, T Value, T factor = 1 ); private: void beginRun(const Run&, const EventSetup&) override; @@ -58,6 +61,12 @@ namespace trackFindingTracklet { const Setup* setup_; // helper class to extract structured data from TTDTC::Frames const DataFormats* dataFormats_; + // Bins for dPhi/dZ use to create weight LUT + vector dPhiBins_; + vector dZBins_; + + // Constant used throughout for partial ttrack words + int partialTrackWordBits_; }; ProducerKFout::ProducerKFout(const ParameterSet& iConfig) : @@ -92,6 +101,24 @@ namespace trackFindingTracklet { setup_->checkHistory(iRun.processHistory()); // helper class to extract structured data from TTDTC::Frames dataFormats_ = &iSetup.getData(esGetTokenDataFormats_); + + // Calculate 1/dz**2 and 1/dphi**2 bins for v0 and v1 weightings + for (int i = 0; i < pow(2,dataFormats_->width(Variable::dPhi, Process::kfin)) / pow(2, setup_->weightBinFraction()); i++) + dPhiBins_.push_back( pow(dataFormats_->base(Variable::dPhi, Process::kfin) * ( i + 1) * pow(2, setup_->weightBinFraction()),-2)); + + for (int i = 0; i < pow(2,dataFormats_->width(Variable::dZ, Process::kfin)) / pow(2, setup_->weightBinFraction()); i++) + dZBins_.push_back( pow(dataFormats_->base(Variable::dZ, Process::kfin) * ( i + 1) * pow(2, setup_->weightBinFraction()),-2)); + + partialTrackWordBits_ = TTBV::S_/2; + } + + // Helper function to convert floating chi2 to chi2 bin + template + int ProducerKFout::digitise(const vector Bins, T Value, T factor ) { + for (int i = 0; i < (int)Bins.size(); i++){ + if (Value*factor > Bins[i] && Value*factor <= Bins[i+1]) {return i;} + } + return -1; } void ProducerKFout::produce(Event& iEvent, const EventSetup& iSetup) { @@ -109,19 +136,152 @@ namespace trackFindingTracklet { Handle handleTTTrackRefMap; iEvent.getByToken(edGetTokenTTTrackRefMap_, handleTTTrackRefMap); const TTTrackRefMap& ttTrackRefMap = *handleTTTrackRefMap.product(); - // perform KFout emulation and fill accepted and lost - // StreamsTrack is a vector of StreamTrack which is a vector of FrameTrack which is a pair of an edm::Ref and std::bitset<64> - // the std::bitset<64> are the frames of an emp link - // the edm::Ref is used to meassure tracking efficiency - // your input streamsTracks contain edm::Ref to KF input TTTracks - // use ttTrackRefMap to lookup edm::Ref of KF output TTTracks, that allows us to meassure the tracking efficiency after the KFout block - // your output frames belong to either only one TTTrack or to two, in the later case chose any edm::Ref of the two - } + // 18 Output Links (First Vector) each has a vector of tracks per event (second vector) each track is 3 32 bit TTBV partial tracks + vector> SortedPartialTracks(setup_->numRegions() * setup_->tfpNumChannel(),vector(0)); + //vector> TrackStreams(setup_->numRegions() * setup_->tfpNumChannel(),vector); + + //Time//regions//Links std::vector< std::vector< std::vector > > > TrackKFOutSAPtrCollectionss; + TrackKFOutSAPtrCollectionss InTrackStreams; + TrackKFOutSAPtrCollectionss OutTrackStreams; + + for (int iRegion = 0; iRegion < setup_->numRegions(); iRegion++){ + TrackKFOutSAPtrCollections temp_collection; + for (int iLink=0; iLink < setup_->tfpNumChannel(); iLink++){ + TrackKFOutSAPtrCollection temp; + for (int iTrack = 0; iTrack < setup_->numFramesIO()* ((double)TTBV::S_/setup_->tttrackBits()); iTrack++) + temp.emplace_back(std::make_shared()); + temp_collection.push_back(temp); + } + InTrackStreams.push_back(temp_collection); + OutTrackStreams.push_back(temp_collection); + } + + + StreamsTrack OutputStreamsTracks(setup_->numRegions() * setup_->tfpNumChannel()); + + for (int iLink = 0; iLink < (int)streamsTracks.size(); iLink++ ){ + + for (int iTrack = 0; iTrack < (int)streamsTracks[iLink].size(); iTrack++ ){ + const auto& track = streamsTracks[iLink].at(iTrack); + TrackKF InTrack(track,dataFormats_); + + double temp_z0 = InTrack.zT() - ((InTrack.cot() * setup_->chosenRofZ())); + + // Correction to Phi calcuation depending if +ve/-ve phi sector + const double baseSectorCorr = InTrack.sectorPhi() ? -setup_->baseSector(): setup_->baseSector(); + + double temp_phi0 = InTrack.phiT() - ((InTrack.inv2R()) * setup_->hybridChosenRofPhi()) + baseSectorCorr; + + double temp_tanL = InTrack.cotGlobal(); + + TTBV HitPattern(0,setup_->numLayers()); + + double tempchi2rphi = 0; + double tempchi2rz = 0; + + for (int iStub = 0; iStub < setup_->numLayers() - 1; iStub++ ){ + const auto& stub = streamsStubs[setup_->numLayers()*iLink+iStub].at(iTrack); + StubKF InStub(stub,dataFormats_,iStub); + + if (!stub.first.isNonnull()) + continue; + + HitPattern.set(iStub); + double phiSquared = pow(InStub.phi(),2); + double zSquared = pow(InStub.z(),2); + + double tempv0 = dPhiBins_[(InStub.dPhi()/(dataFormats_->base(Variable::dPhi, Process::kfin)*pow(2,setup_->weightBinFraction())))]; + double tempv1 = dZBins_[(InStub.dZ()/(dataFormats_->base(Variable::dZ, Process::kfin)*pow(2,setup_->weightBinFraction())))]; + + double tempRphi = phiSquared * tempv0; + double tempRz = zSquared * tempv1; + + tempchi2rphi += tempRphi; + tempchi2rz += tempRz; + } // Iterate over track stubs + + // TODO extract TTTrack bit widths from TTTrack word pending update to the TTTrack_word class + TTBV TrackValid(1,1,false); + TTBV extraMVA(0,6,false); + TTBV TQMVA(0,3,false); + TTBV BendChi2(0,3,false); + TTBV Chi2rphi(digitise(setup_->kfoutchi2rphiBins(),tempchi2rphi,(double)setup_->kfoutchi2rphiConv()),4,false); + TTBV Chi2rz(digitise(setup_->kfoutchi2rzBins(),tempchi2rz,(double)setup_->kfoutchi2rzConv()),4,false); + TTBV D0(0,13,false); + TTBV z0(temp_z0 ,dataFormats_->base(Variable::zT,Process::kf) ,12,true); + TTBV TanL(temp_tanL,dataFormats_->base(Variable::cot,Process::kf),16,true); + TTBV phi0(temp_phi0,dataFormats_->base(Variable::phiT,Process::kf),12,true); + TTBV InvR(-InTrack.inv2R(),dataFormats_->base(Variable::inv2R,Process::kf) ,16,true ); + InvR.resize(15); + // 13 + 3 + 7 + 3 + 3 + TTBV PartialTrack3((D0 + BendChi2 + HitPattern + TQMVA + extraMVA),partialTrackWordBits_,false); + // 16 + 12 + 4 + TTBV PartialTrack2((TanL + z0 + Chi2rz),partialTrackWordBits_,false); + // 1 + 15 + 12 + 4 + TTBV PartialTrack1((TrackValid + InvR + phi0 + Chi2rphi),partialTrackWordBits_,false); + + + int sortKey = (InTrack.sectorEta() < (int)(setup_->numSectorsEta()/2)) ? 0 : 1; + TrackKFOut Temp_track(PartialTrack1,PartialTrack2,PartialTrack3,sortKey,track,iTrack,iLink,true); + + InTrackStreams[iLink/2][iLink%2][iTrack] = (std::make_shared(Temp_track)); + } // Iterate over Tracks + } // Iterate over Links + // Fill products and match up tracks + + vector< DistServer > distServers(setup_->numRegions(), DistServer(2, setup_->tfpNumChannel(),2)); //Magic Numbers + + for (int i=0; inumRegions(); i++){ + for (int iTrack=0; iTracknumFramesIO()* ((double)TTBV::S_/setup_->tttrackBits()); iTrack++){ + TrackKFOutSAPtrCollection DistIn; + DistIn.push_back(InTrackStreams[i][0][iTrack]); + DistIn.push_back(InTrackStreams[i][1][iTrack]); + TrackKFOutSAPtrCollection DistOut = distServers[i].clock(DistIn); + for (int iLink=0; iLinktfpNumChannel(); iLink++) + OutTrackStreams[i][iLink][iTrack] = DistOut[iLink]; + } + } + + for (int iRegion = 0; iRegion < setup_->numRegions(); iRegion++ ){ + for (int iLink = 0; iLink < setup_->tfpNumChannel(); iLink++ ){ + for (int iTrack = 0; iTrack < (int)OutTrackStreams[iRegion][iLink].size(); iTrack++ ){ + SortedPartialTracks[2*iRegion+iLink].push_back(OutTrackStreams[iRegion][iLink][iTrack]->PartialTrack1()); + SortedPartialTracks[2*iRegion+iLink].push_back(OutTrackStreams[iRegion][iLink][iTrack]->PartialTrack2()); + SortedPartialTracks[2*iRegion+iLink].push_back(OutTrackStreams[iRegion][iLink][iTrack]->PartialTrack3()); + OutputStreamsTracks[2*iRegion+iLink].emplace_back(OutTrackStreams[iRegion][iLink][iTrack]->track()); + } + } + } + + const TTBV NullBitTrack(0,partialTrackWordBits_,false); + for (int iLink = 0; iLink < (int)OutputStreamsTracks.size(); iLink++ ){ + // Iterate through partial tracks + int numLinkTracks = (int)OutputStreamsTracks[iLink].size(); + if (numLinkTracks == 0) + continue; // Don't fill links if no tracks + if ((numLinkTracks % 2 != 0)) { + SortedPartialTracks[iLink].push_back(NullBitTrack); //Pad out final set of bits + OutputStreamsTracks[iLink].emplace_back(OutputStreamsTracks[iLink][numLinkTracks++]); //Pad out with final repeated track + } //If there is an odd number of tracks + for (int iTrack = 0; iTrack < (int)(SortedPartialTracks[iLink].size()); iTrack++ ){ + if (iTrack % 2 != 1) // Write to links every other partial track, 3 partial tracks per full TTTrack + continue; + TTTrackRef TrackRef; + for (auto &it : ttTrackRefMap) { //Iterate through ttTrackRefMap to find TTTrackRef Key by a TTTrack Value + if(it.second == OutputStreamsTracks[iLink][(int)(iTrack-1)/3].first) + TrackRef = it.first; + } + if ((int)iTrack/3 <= setup_->numFramesIO()* ((double)TTBV::S_/setup_->tttrackBits())) + accepted[iLink].emplace_back(std::make_pair(TrackRef,(SortedPartialTracks[iLink][iTrack-1].slice(partialTrackWordBits_) + SortedPartialTracks[iLink][iTrack].slice(partialTrackWordBits_)).bs())); + else + lost[iLink].emplace_back(std::make_pair(TrackRef,(SortedPartialTracks[iLink][iTrack-1].slice(partialTrackWordBits_) + SortedPartialTracks[iLink][iTrack].slice(partialTrackWordBits_)).bs())); + } //Iterate through sorted partial tracks + } // Iterate through links + } // Config Supported // store products iEvent.emplace(edPutTokenAccepted_, move(accepted)); iEvent.emplace(edPutTokenLost_, move(lost)); } - } // namespace trackFindingTracklet -DEFINE_FWK_MODULE(trackFindingTracklet::ProducerKFout); \ No newline at end of file +DEFINE_FWK_MODULE(trackFindingTracklet::ProducerKFout); diff --git a/L1Trigger/TrackTrigger/interface/Setup.h b/L1Trigger/TrackTrigger/interface/Setup.h index a4ccd3532ad34..6d2aa863a4381 100644 --- a/L1Trigger/TrackTrigger/interface/Setup.h +++ b/L1Trigger/TrackTrigger/interface/Setup.h @@ -116,7 +116,7 @@ namespace tt { // const std::vector& sensorModules() const { return sensorModules_; } - // Fimrware specific Parameter + // Firmware specific Parameter // width of the 'A' port of an DSP slice int widthDSPa() const { return widthDSPa_; } @@ -447,6 +447,21 @@ namespace tt { // search window of each track parameter in initial uncertainties double kfRangeFactor() const { return kfRangeFactor_; } + // Parameter specifying KalmanFilter Output Formatter + + // Final Chi2rphi digitization TODO extract from TTTrack Word + std::vector kfoutchi2rphiBins() const { return kfoutchi2rphiBins_; } + // Final Chi2rz digitization TODO extract from TTTrack Word + std::vector kfoutchi2rzBins() const { return kfoutchi2rzBins_; } + // Conversion factor between dphi^2/weight and chi2rphi + int kfoutchi2rphiConv() const { return kfoutchi2rphiConv_; } + // Conversion factor between dz^2/weight and chi2rz + int kfoutchi2rzConv() const { return kfoutchi2rzConv_; } + // Number of bits for the tttrack word + int tttrackBits() const { return tttrackBits_; } + // Fraction of total dphi and dz ranges to calculate v0 and v1 LUT for + int weightBinFraction() const { return weightBinFraction_; } + // Parameter specifying DuplicateRemoval // internal memory depth @@ -606,7 +621,7 @@ namespace tt { // required number of associated ps layers to a TP to consider it reconstruct-able int tpMinLayersPS_; - // Fimrware specific Parameter + // Firmware specific Parameter edm::ParameterSet pSetFW_; // width of the 'A' port of an DSP slice int widthDSPa_; @@ -803,6 +818,29 @@ namespace tt { // search window of each track parameter in initial uncertainties double kfRangeFactor_; + // Parameter specifying KalmanFilter Output Formatter + edm::ParameterSet pSetKFOut_; + // Bins used to digitize dPhi for chi2 calculation + std::vector kfoutdPhiBins_; + // Bins used to digitize dZ for chi2 calculation + std::vector kfoutdZBins_; + // v0 weight Bins corresponding to dPhi Bins for chi2 calculation + std::vector kfoutv0Bins_; + // v1 weight Bins corresponding to dZ Bins for chi2 calculation + std::vector kfoutv1Bins_; + // Final Chi2rphi digitization TODO extract from TTTrack Word + std::vector kfoutchi2rphiBins_; + // Final Chi2rz digitization TODO extract from TTTrack Word + std::vector kfoutchi2rzBins_; + // Conversion factor between dphi^2/weight and chi2rphi + int kfoutchi2rphiConv_; + // Conversion factor between dz^2/weight and chi2rz + int kfoutchi2rzConv_; + // Number of bits for the tttrack word + int tttrackBits_; + // Fraction of total dphi and dz ranges to calculate v0 and v1 LUT for + int weightBinFraction_; + // Parameter specifying DuplicateRemoval edm::ParameterSet pSetDR_; // internal memory depth diff --git a/L1Trigger/TrackTrigger/python/ProducerSetup_cfi.py b/L1Trigger/TrackTrigger/python/ProducerSetup_cfi.py index 3f53213d6fbb5..48fc040b89c15 100644 --- a/L1Trigger/TrackTrigger/python/ProducerSetup_cfi.py +++ b/L1Trigger/TrackTrigger/python/ProducerSetup_cfi.py @@ -103,7 +103,7 @@ #MaxdPhi = cms.double( 0.01 ), # maximum representable stub phi uncertainty MaxdPhi = cms.double( 0.02 ), # maximum representable stub phi uncertainty MindZ = cms.double( 0.1 ), # minimum representable stub z uncertainty - MaxdZ = cms.double( 30. ) # maximum representable stub z uncertainty + MaxdZ = cms.double( 30. ), # maximum representable stub z uncertainty ), # Parmeter specifying front-end @@ -191,6 +191,19 @@ MaxLayers = cms.int32 ( 4 ) # maximum number of layers added to a track ), + # Parmeter specifying KalmanFilter Output Formatter + KalmanFilterOut = cms.PSet ( + chi2rphiBins = cms.vdouble( 0, 0.25, 0.5, 1, 2, 3, 5, 7, 10, 20, 40, 100, 200, 500, 1000, 3000,6000 ), # Final Chi2rphi digitization TODO extract from TTTrack Word + chi2rzBins = cms.vdouble( 0, 0.25, 0.5, 1, 2, 3, 5, 7, 10, 20, 40, 100, 200, 500, 1000, 3000,6000 ), # Final Chi2rz digitization TODO extract from TTTrack Word + + chi2rphiConv = cms.int32 ( 3 ), # Conversion factor between dphi^2/weight and chi2rphi + chi2rzConv = cms.int32 ( 13 ), # Conversion factor between dz^2/weight and chi2rz + + WeightBinFraction = cms.int32( 0 ), # Number of bits dropped from dphi and dz for v0 and v1 LUTs + + TTTrackBits = cms.int32( 96 ) # Number of bits for the tttrack word TODO extract from TTTrack_word dataformat + ), + # Parmeter specifying DuplicateRemoval DuplicateRemoval = cms.PSet ( DepthMemory = cms.int32( 16 ) # internal memory depth diff --git a/L1Trigger/TrackTrigger/src/Setup.cc b/L1Trigger/TrackTrigger/src/Setup.cc index 7898b0ae2e274..1b440dd49d328 100644 --- a/L1Trigger/TrackTrigger/src/Setup.cc +++ b/L1Trigger/TrackTrigger/src/Setup.cc @@ -187,6 +187,14 @@ namespace tt { kfMinLayers_(pSetKF_.getParameter("MinLayers")), kfMaxLayers_(pSetKF_.getParameter("MaxLayers")), kfRangeFactor_(pSetKF_.getParameter("RangeFactor")), + // Parmeter specifying KalmanFilter Output Formatter + pSetKFOut_(iConfig.getParameter("KalmanFilterOut")), + kfoutchi2rphiBins_(pSetKFOut_.getParameter>("chi2rphiBins")), + kfoutchi2rzBins_(pSetKFOut_.getParameter>("chi2rzBins")), + kfoutchi2rphiConv_(pSetKFOut_.getParameter("chi2rphiConv")), + kfoutchi2rzConv_(pSetKFOut_.getParameter("chi2rzConv")), + tttrackBits_(pSetKFOut_.getParameter("TTTrackBits")), + weightBinFraction_(pSetKFOut_.getParameter("WeightBinFraction")), // Parmeter specifying DuplicateRemoval pSetDR_(iConfig.getParameter("DuplicateRemoval")), drDepthMemory_(pSetDR_.getParameter("DepthMemory")) { diff --git a/L1Trigger/TrackerTFP/interface/DataFormats.h b/L1Trigger/TrackerTFP/interface/DataFormats.h index 65e0f7e4d9d5d..c7c51f2ebfc3f 100644 --- a/L1Trigger/TrackerTFP/interface/DataFormats.h +++ b/L1Trigger/TrackerTFP/interface/DataFormats.h @@ -665,11 +665,60 @@ namespace trackerTFP { double cot() const { return std::get<5>(data_); } // track z at radius chosenRofZ wrt eta sector centre double zT() const { return std::get<6>(data_); } + // global cotTheta + double cotGlobal() const { return cot() + setup()->sectorCot(sectorEta()); } // conversion to TTTrack with given stubs TTTrack ttTrack(const std::vector& stubs) const; private: }; + //Class to represent KFout 96-bit track for use in distribution server + class TrackKFOut { + public: + TrackKFOut() : TrackKFOut(0,0,0,0,tt::FrameTrack(), 0, 0, false) {} + // construct TrackKF from Partial Tracks + TrackKFOut(TTBV PartialTrack1, TTBV PartialTrack2, TTBV PartialTrack3, int sortKey,const tt::FrameTrack& track,int trackID, int linkID, bool valid) + : PartialTrack1_(PartialTrack1), + PartialTrack2_(PartialTrack2), + PartialTrack3_(PartialTrack3), + sortKey_(sortKey), + track_(track), + trackID_(trackID), + linkID_(linkID), + valid_(valid) { + }; + + ~TrackKFOut(){} + + int sortKey() const { return sortKey_; } + + bool dataValid() const { return valid_; } + + int trackID() const { return trackID_; } + int linkID() const { return linkID_; } + + TTBV PartialTrack1() const { return PartialTrack1_; } + TTBV PartialTrack2() const { return PartialTrack2_; } + TTBV PartialTrack3() const { return PartialTrack3_; } + + tt::FrameTrack track() const { return track_; } + + private: + TTBV PartialTrack1_ ; + TTBV PartialTrack2_; + TTBV PartialTrack3_; + int sortKey_; + tt::FrameTrack track_; + int trackID_; + int linkID_; + bool valid_; + }; + + typedef std::vector TrackKFOutSACollection; + typedef std::shared_ptr TrackKFOutSAPtr; + typedef std::vector TrackKFOutSAPtrCollection; + typedef std::vector< std::vector > > TrackKFOutSAPtrCollections; + typedef std::vector< std::vector< std::vector > > > TrackKFOutSAPtrCollectionss; // class to represent tracks generated by process duplicate removal class TrackDR : public Track { public: diff --git a/L1Trigger/TrackerTFP/interface/DistServer.h b/L1Trigger/TrackerTFP/interface/DistServer.h new file mode 100644 index 0000000000000..c80707231a090 --- /dev/null +++ b/L1Trigger/TrackerTFP/interface/DistServer.h @@ -0,0 +1,33 @@ +#ifndef L1Trigger_TrackerTFP_DistServer_h__ +#define L1Trigger_TrackerTFP_DistServer_h__ + +#include "L1Trigger/TrackerTFP/interface/DataFormats.h" + +#include + +namespace trackerTFP { + + class DistServer { + public: + DistServer( unsigned int nInputs, unsigned int nOutputs, unsigned int nInterleaving ); + ~DistServer() {} + + TrackKFOutSAPtrCollection clock(TrackKFOutSAPtrCollection& inputs); + + unsigned int nInputs() const { return nInputs_; } + unsigned int nOutputs() const { return nOutputs_; } + unsigned int nInterleaving() const { return nInterleaving_; } + std::vector< std::vector< unsigned int> >& addr() { return addr_; } + TrackKFOutSAPtrCollections& inputs() { return inputs_; } + + private: + unsigned int nInputs_; + unsigned int nOutputs_; + unsigned int nInterleaving_; + + TrackKFOutSAPtrCollections inputs_; + std::vector< std::vector< unsigned int> > addr_; + }; +} + +#endif \ No newline at end of file diff --git a/L1Trigger/TrackerTFP/src/DistServer.cc b/L1Trigger/TrackerTFP/src/DistServer.cc new file mode 100644 index 0000000000000..a1387ffee23a3 --- /dev/null +++ b/L1Trigger/TrackerTFP/src/DistServer.cc @@ -0,0 +1,66 @@ +#include "L1Trigger/TrackerTFP/interface/DistServer.h" +#include "L1Trigger/TrackerTFP/interface/DataFormats.h" + + +#include +#include + +using namespace std; +using namespace trackerTFP; + +DistServer::DistServer( unsigned int nInputs, unsigned int nOutputs, unsigned int nInterleaving ) : + nInputs_(nInputs), + nOutputs_(nOutputs), + nInterleaving_(nInterleaving), + inputs_(nInputs_) { + for ( unsigned int iInput=0; iInputnInputs(); ++iInput ) { + addr_.emplace_back(this->nInterleaving(),0); + for ( unsigned int iInterleave=0; iInterleavenInterleaving(); ++iInterleave ) { + addr_[iInput][iInterleave] = iInterleave; + } + } + } + +TrackKFOutSAPtrCollection DistServer::clock(TrackKFOutSAPtrCollection& data) { + for ( unsigned int iInput=0; iInputdataValid() ) { + inputs()[iInput].push_back( data[iInput] ); + } + } + + vector< vector< bool > > lMap(nInputs(), vector(nOutputs()) ); + + TrackKFOutSAPtrCollection lInputs(nInputs(),std::make_shared()); + + std::vector< std::vector< unsigned int> >& addr = this->addr(); + + for ( unsigned int iInput = 0; iInputsortKey() ] = true; + } + } + + for ( unsigned int iInput = 0; iInput& toRotate = addr[iInput]; + rotate(toRotate.begin(), toRotate.begin()+1, toRotate.end() ); + } + + TrackKFOutSAPtrCollection lOutputs(nOutputs(),std::make_shared()); + + unsigned int nOutputs = 0; + for ( unsigned int iOutput = 0; iOutputnInterleaving(); + nOutputs++; + break; + } + } + } + + + return lOutputs; +} \ No newline at end of file diff --git a/L1Trigger/TrackerTFP/test/AnalyzerDemonstrator.cc b/L1Trigger/TrackerTFP/test/AnalyzerDemonstrator.cc index 80e042a5d6f69..388cb64831b0b 100644 --- a/L1Trigger/TrackerTFP/test/AnalyzerDemonstrator.cc +++ b/L1Trigger/TrackerTFP/test/AnalyzerDemonstrator.cc @@ -62,11 +62,13 @@ namespace trackerTFP { const string& labelOut = iConfig.getParameter("LabelOut"); const string& branchStubs = iConfig.getParameter("BranchAcceptedStubs"); const string& branchTracks = iConfig.getParameter("BranchAcceptedTracks"); + edGetTokenStubsIn_ = consumes(InputTag(labelIn, branchStubs)); - edGetTokenStubsOut_ = consumes(InputTag(labelOut, branchStubs)); + if (labelOut != "TrackFindingTrackletProducerKFout") + edGetTokenStubsOut_ = consumes(InputTag(labelOut, branchStubs)); if (labelIn == "TrackerTFPProducerKFin" || labelIn == "TrackerTFPProducerKF" || labelIn == "TrackFindingTrackletProducerKFin" || labelIn == "TrackFindingTrackletProducerKF") edGetTokenTracksIn_ = consumes(InputTag(labelIn, branchTracks)); - if (labelOut == "TrackerTFPProducerKF" || labelOut == "TrackerTFPProducerDR" || labelOut == "TrackFindingTrackletProducerKF") + if (labelOut == "TrackerTFPProducerKF" || labelOut == "TrackerTFPProducerDR" || labelOut == "TrackFindingTrackletProducerKF" || labelOut == "TrackFindingTrackletProducerKFout") edGetTokenTracksOut_ = consumes(InputTag(labelOut, branchTracks)); // book ES products esGetTokenSetup_ = esConsumes(); @@ -94,10 +96,14 @@ namespace trackerTFP { // void AnalyzerDemonstrator::convert(const Event& iEvent, const EDGetTokenT& tokenTracks, const EDGetTokenT& tokenStubs, vector>& bits) const { const bool tracks = !tokenTracks.isUninitialized(); + const bool stubs = !tokenStubs.isUninitialized(); Handle handleStubs; Handle handleTracks; - iEvent.getByToken(tokenStubs, handleStubs); - int numChannelStubs = handleStubs->size(); + int numChannelStubs(0); + if (stubs){ + iEvent.getByToken(tokenStubs, handleStubs); + numChannelStubs = handleStubs->size(); + } int numChannelTracks(0); if (tracks) { iEvent.getByToken(tokenTracks, handleTracks); @@ -112,12 +118,15 @@ namespace trackerTFP { const int offsetStubs = (region * numChannelTracks + channelTracks) * numChannelStubs; if (tracks) convert(handleTracks->at(offsetTracks + channelTracks), bits); - for (int channelStubs = 0; channelStubs < numChannelStubs; channelStubs++) - convert(handleStubs->at(offsetStubs + channelStubs), bits); + if (stubs){ + for (int channelStubs = 0; channelStubs < numChannelStubs; channelStubs++) + convert(handleStubs->at(offsetStubs + channelStubs), bits); + } } } } + // template void AnalyzerDemonstrator::convert(const T& collection, vector>& bits) const {