Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-10-14 01:44:00

0001 //This class holds functional blocks of a sector
0002 #ifndef L1Trigger_TrackFindingTracklet_interface_Sector_h
0003 #define L1Trigger_TrackFindingTracklet_interface_Sector_h
0004 
0005 #include "L1Trigger/TrackFindingTracklet/interface/L1TStub.h"
0006 #include "L1Trigger/TrackFindingTracklet/interface/SLHCEvent.h"
0007 #include "L1Trigger/TrackFindingTracklet/interface/StubStreamData.h"
0008 
0009 #include <string>
0010 #include <map>
0011 #include <memory>
0012 #include <vector>
0013 #include <unordered_set>
0014 #include <fstream>
0015 #include <unordered_map>
0016 
0017 namespace trklet {
0018 
0019   class Settings;
0020   class Globals;
0021   class ProcessBase;
0022   class MemoryBase;
0023   class Tracklet;
0024   class Track;
0025   class Stub;
0026 
0027   //Memory modules
0028   class DTCLinkMemory;
0029   class InputLinkMemory;
0030   class AllStubsMemory;
0031   class AllInnerStubsMemory;
0032   class VMStubsTEMemory;
0033   class VMStubsMEMemory;
0034   class StubPairsMemory;
0035   class StubTripletsMemory;
0036   class TrackletParametersMemory;
0037   class TrackletProjectionsMemory;
0038   class AllProjectionsMemory;
0039   class VMProjectionsMemory;
0040   class CandidateMatchMemory;
0041   class FullMatchMemory;
0042   class TrackFitMemory;
0043   class CleanTrackMemory;
0044 
0045   //Processing modules
0046   class InputRouter;
0047   class VMRouter;
0048   class VMRouterCM;
0049   class TrackletEngine;
0050   class TrackletEngineDisplaced;
0051   class TripletEngine;
0052   class TrackletCalculator;
0053   class TrackletProcessor;
0054   class TrackletProcessorDisplaced;
0055   class TrackletCalculatorDisplaced;
0056   class ProjectionRouter;
0057   class MatchEngine;
0058   class MatchCalculator;
0059   class MatchProcessor;
0060   class FitTrack;
0061   class PurgeDuplicate;
0062 
0063   class Sector {
0064   public:
0065     Sector(Settings const& settings, Globals* globals);
0066 
0067     ~Sector();
0068 
0069     //Set the sector
0070     void setSector(unsigned int isector);
0071 
0072     bool addStub(L1TStub stub, std::string dtc);  //TODO - should be pointer or string
0073 
0074     // Creates all required memory modules based on wiring map (args: module type, module instance)
0075     void addMem(std::string memType, std::string memName);
0076 
0077     // Creates all required processing modules based on wiring map (args: module type, module instance)
0078     void addProc(std::string procType, std::string procName);
0079 
0080     //--- Create all required proc -> mem module connections, based on wiring map
0081     //--- (args: memory instance & input/output proc modules it connects to in format procName.pinName)
0082     void addWire(std::string mem, std::string procinfull, std::string procoutfull);
0083 
0084     ProcessBase* getProc(std::string procName);
0085     MemoryBase* getMem(std::string memName);
0086 
0087     void writeDTCStubs(bool first);
0088     void writeIRStubs(bool first);
0089     void writeVMSTE(bool first);
0090     void writeVMSME(bool first);
0091     void writeAS(bool first);
0092     void writeAIS(bool first);
0093     void writeSP(bool first);
0094     void writeST(bool first);
0095     void writeTPAR(bool first);
0096     void writeTPROJ(bool first);
0097     void writeAP(bool first);
0098     void writeVMPROJ(bool first);
0099     void writeCM(bool first);
0100     void writeMC(bool first);
0101     void writeTF(bool first);
0102     void writeCT(bool first);
0103 
0104     void clean();
0105 
0106     // execute the different tracklet processing modules
0107     void executeIR();
0108     void executeVMR();
0109     void executeTE();
0110     void executeTED();
0111     void executeTRE();
0112     void executeTP();
0113     void executeTPD();
0114     void executeTC();
0115     void executeTCD();
0116     void executePR();
0117     void executeME();
0118     void executeMC();
0119     void executeMP();
0120     void executeFT(std::vector<std::vector<std::string>>& streamsTrackRaw,
0121                    std::vector<std::vector<StubStreamData>>& streamsStubRaw);
0122     void executePD(std::vector<Track>& tracks);
0123 
0124     std::vector<Tracklet*> getAllTracklets() const;
0125     std::vector<const Stub*> getStubs() const;
0126 
0127     std::unordered_set<int> seedMatch(int itp) const;
0128 
0129     double phimin() const { return phimin_; }
0130     double phimax() const { return phimax_; }
0131 
0132     template <typename TV, typename... Args>
0133     void addMemToVec(std::vector<std::unique_ptr<TV>>& memvec, const std::string& memName, Args&... args) {
0134       memvec.push_back(std::make_unique<TV>(memName, std::forward<Args>(args)...));
0135       Memories_[memName] = memvec.back().get();
0136       MemoriesV_.push_back(memvec.back().get());
0137     }
0138 
0139     template <typename TV, typename... Args>
0140     void addProcToVec(std::vector<std::unique_ptr<TV>>& procvec, const std::string& procName, Args&... args) {
0141       procvec.push_back(std::make_unique<TV>(procName, std::forward<Args>(args)...));
0142       Processes_[procName] = procvec.back().get();
0143     }
0144 
0145   private:
0146     int isector_;
0147     Settings const& settings_;
0148     Globals* globals_;
0149     double phimin_;
0150     double phimax_;
0151 
0152     std::map<std::string, MemoryBase*> Memories_;
0153     std::vector<MemoryBase*> MemoriesV_;
0154     std::vector<std::unique_ptr<DTCLinkMemory>> DL_;
0155     std::vector<std::unique_ptr<InputLinkMemory>> IL_;
0156     std::vector<std::unique_ptr<AllStubsMemory>> AS_;
0157     std::vector<std::unique_ptr<AllInnerStubsMemory>> AIS_;
0158     std::vector<std::unique_ptr<VMStubsTEMemory>> VMSTE_;
0159     std::vector<std::unique_ptr<VMStubsMEMemory>> VMSME_;
0160     std::vector<std::unique_ptr<StubPairsMemory>> SP_;
0161     std::vector<std::unique_ptr<StubTripletsMemory>> ST_;
0162     std::vector<std::unique_ptr<TrackletParametersMemory>> TPAR_;
0163     std::vector<std::unique_ptr<TrackletProjectionsMemory>> TPROJ_;
0164     std::vector<std::unique_ptr<AllProjectionsMemory>> AP_;
0165     std::vector<std::unique_ptr<VMProjectionsMemory>> VMPROJ_;
0166     std::vector<std::unique_ptr<CandidateMatchMemory>> CM_;
0167     std::vector<std::unique_ptr<FullMatchMemory>> FM_;
0168     std::vector<std::unique_ptr<TrackFitMemory>> TF_;
0169     std::vector<std::unique_ptr<CleanTrackMemory>> CT_;
0170 
0171     std::map<std::string, ProcessBase*> Processes_;
0172     std::vector<std::unique_ptr<InputRouter>> IR_;
0173     std::vector<std::unique_ptr<VMRouter>> VMR_;
0174     std::vector<std::unique_ptr<VMRouterCM>> VMRCM_;
0175     std::vector<std::unique_ptr<TrackletEngine>> TE_;
0176     std::vector<std::unique_ptr<TrackletEngineDisplaced>> TED_;
0177     std::vector<std::unique_ptr<TripletEngine>> TRE_;
0178     std::vector<std::unique_ptr<TrackletProcessor>> TP_;
0179     std::vector<std::unique_ptr<TrackletProcessorDisplaced>> TPD_;
0180     std::vector<std::unique_ptr<TrackletCalculator>> TC_;
0181     std::vector<std::unique_ptr<TrackletCalculatorDisplaced>> TCD_;
0182     std::vector<std::unique_ptr<ProjectionRouter>> PR_;
0183     std::vector<std::unique_ptr<MatchEngine>> ME_;
0184     std::vector<std::unique_ptr<MatchCalculator>> MC_;
0185     std::vector<std::unique_ptr<MatchProcessor>> MP_;
0186     std::vector<std::unique_ptr<FitTrack>> FT_;
0187     std::vector<std::unique_ptr<PurgeDuplicate>> PD_;
0188   };
0189 };  // namespace trklet
0190 #endif