CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
CSCTFTrackBuilder Class Reference

#include <CSCTFTrackBuilder.h>

Public Types

enum  { nEndcaps = 2, nSectors = 6 }
 

Public Member Functions

void buildTracks (const CSCCorrelatedLCTDigiCollection *, const CSCTriggerContainer< csctf::TrackStub > *, L1CSCTrackCollection *, CSCTriggerContainer< csctf::TrackStub > *)
 
 CSCTFTrackBuilder (const edm::ParameterSet &pset, bool TMB07, const L1MuTriggerScales *scales, const L1MuTriggerPtScale *ptScale)
 
void initialize (const edm::EventSetup &c)
 
 ~CSCTFTrackBuilder ()
 

Private Attributes

int m_maxBX
 
int m_minBX
 
CSCTFSectorProcessormy_SPs [nEndcaps][nSectors]
 

Detailed Description

Definition at line 19 of file CSCTFTrackBuilder.h.

Member Enumeration Documentation

anonymous enum
Enumerator
nEndcaps 
nSectors 

Definition at line 25 of file CSCTFTrackBuilder.h.

Constructor & Destructor Documentation

CSCTFTrackBuilder::CSCTFTrackBuilder ( const edm::ParameterSet pset,
bool  TMB07,
const L1MuTriggerScales scales,
const L1MuTriggerPtScale ptScale 
)

Definition at line 18 of file CSCTFTrackBuilder.cc.

References alignCSCRings::e, edm::ParameterSet::getParameter(), m_maxBX, m_minBX, CSCDetId::maxEndcapId(), CSCTriggerNumbering::maxTriggerSectorId(), CSCDetId::minEndcapId(), CSCTriggerNumbering::minTriggerSectorId(), my_SPs, and alignCSCRings::s.

20  {
21  m_minBX = pset.getParameter<int>("MinBX");
22  m_maxBX = pset.getParameter<int>("MaxBX");
23 
24  for(int e = CSCDetId::minEndcapId(); e <= CSCDetId::maxEndcapId(); ++e)
25  {
28  {
29  // All SPs work with the same configuration (impossible to make it more exclusive in this framework)
30  my_SPs[e-1][s-1] = new CSCTFSectorProcessor(e, s, pset, TMB07,
31  scales, ptScale);
32  }
33  }
34 }
T getParameter(std::string const &) const
static int minEndcapId()
Definition: CSCDetId.h:249
static int maxTriggerSectorId()
static int minTriggerSectorId()
static int maxEndcapId()
Definition: CSCDetId.h:250
CSCTFSectorProcessor * my_SPs[nEndcaps][nSectors]
CSCTFTrackBuilder::~CSCTFTrackBuilder ( )

Definition at line 47 of file CSCTFTrackBuilder.cc.

References alignCSCRings::e, CSCDetId::maxEndcapId(), CSCTriggerNumbering::maxTriggerSectorId(), CSCDetId::minEndcapId(), CSCTriggerNumbering::minTriggerSectorId(), my_SPs, NULL, and alignCSCRings::s.

48 {
49  for(int e = CSCDetId::minEndcapId(); e <= CSCDetId::maxEndcapId(); ++e)
50  {
53  {
54  delete my_SPs[e-1][s-1];
55  my_SPs[e-1][s-1] = NULL;
56  }
57  }
58 }
static int minEndcapId()
Definition: CSCDetId.h:249
static int maxTriggerSectorId()
#define NULL
Definition: scimark2.h:8
static int minTriggerSectorId()
static int maxEndcapId()
Definition: CSCDetId.h:250
CSCTFSectorProcessor * my_SPs[nEndcaps][nSectors]

Member Function Documentation

void CSCTFTrackBuilder::buildTracks ( const CSCCorrelatedLCTDigiCollection lcts,
const CSCTriggerContainer< csctf::TrackStub > *  dtstubss,
L1CSCTrackCollection trkcoll,
CSCTriggerContainer< csctf::TrackStub > *  stubs_to_dt 
)

Hmmm how should I implement this??? Maybe change the L1Track to use stubs not LCTs?

Definition at line 60 of file CSCTFTrackBuilder.cc.

References CSCTriggerContainer< T >::clear(), CSCDetId, alignCSCRings::e, end, CSCTFSectorProcessor::filteredStubs(), CSCTriggerContainer< T >::get(), getDQMSummary::iter, m_maxBX, m_minBX, CSCDetId::maxEndcapId(), CSCTriggerNumbering::maxTriggerSectorId(), CSCDetId::minEndcapId(), CSCTriggerNumbering::minTriggerSectorId(), my_SPs, CSCTriggerContainer< T >::push_back(), CSCTriggerContainer< T >::push_many(), CSCTFSectorProcessor::run(), alignCSCRings::s, edm::shift, CSCTFSectorProcessor::tracks(), and CSCTriggerNumbering::triggerSubSectorFromLabels().

Referenced by CSCTFTrackProducer::produce().

63 {
64  std::vector<csc::L1Track> trks;
66 
68 
69  for(Citer = lcts->begin(); Citer != lcts->end(); Citer++)
70  {
71  CSCCorrelatedLCTDigiCollection::const_iterator Diter = (*Citer).second.first;
72  CSCCorrelatedLCTDigiCollection::const_iterator Dend = (*Citer).second.second;
73 
74  for(; Diter != Dend; Diter++)
75  {
76  csctf::TrackStub theStub((*Diter),(*Citer).first);
77  stub_list.push_back(theStub);
78  }
79  }
80 
81  // Now we append the track stubs the the DT Sector Collector
82  // after processing from the DT Receiver.
83 
84 // CSCTriggerContainer<csctf::TrackStub> dtstubs = my_dtrc->process(dttrig);
85 // stub_list.push_many(dtstubs);
86  stub_list.push_many(*dtstubss);
87 
88  // run each sector processor in the TF
89  for(int e = CSCDetId::minEndcapId(); e <= CSCDetId::maxEndcapId(); ++e)
90  {
93  {
94  CSCTriggerContainer<csctf::TrackStub> current_e_s = stub_list.get(e, s);
95  int spReturnValue = my_SPs[e-1][s-1]->run(current_e_s);
96  if(spReturnValue == -1) //Major Error, returning with empty Coll's
97  {
98  trkcoll->clear();
99  stubs_to_dt->clear();
100  return;
101  }
102  else if(spReturnValue)
103  {
104  std::vector<csc::L1Track> theTracks = my_SPs[e-1][s-1]->tracks().get();
105  trks.insert(trks.end(), theTracks.begin(), theTracks.end());
106  }
107  stubs_to_dt->push_many(my_SPs[e-1][s-1]->dtStubs()); // send stubs whether or not we find a track!!!
108  }
109  }
110 
111  // Now to combine tracks with their track stubs and send them off.
112  trkcoll->resize(trks.size());
113  std::vector<csc::L1Track>::const_iterator titr = trks.begin();
114  L1CSCTrackCollection::iterator tcitr = trkcoll->begin();
115 
116  for(; titr != trks.end(); titr++)
117  {
118  tcitr->first = (*titr);
119  std::vector<csctf::TrackStub> possible_stubs = my_SPs[titr->endcap()-1][titr->sector()-1]->filteredStubs();
120  std::vector<csctf::TrackStub>::const_iterator tkstbs = possible_stubs.begin();
121 
122  int me1ID = titr->me1ID();
123  int me2ID = titr->me2ID();
124  int me3ID = titr->me3ID();
125  int me4ID = titr->me4ID();
126  int mb1ID = titr->mb1ID();
127  int me1delay = titr->me1Tbin();
128  int me2delay = titr->me2Tbin();
129  int me3delay = titr->me3Tbin();
130  int me4delay = titr->me4Tbin();
131  int mb1delay = titr->mb1Tbin();
132  // BX analyzer: some stub could be delayed by BXA so that all the stubs will run through the core at the same BX;
133  // then there is a rule of "second earlies LCT": resulting track will be placed at BX of the "second earliest LCT";
134  // in the end there are two parameters in place: the delay by BXA w.r.t to the last LCT and track tbin assignment
135  std::map< int, std::list<int> > timeline;
136  if( me1ID ) timeline[me1delay].push_back(1);
137  if( me2ID ) timeline[me2delay].push_back(2);
138  if( me3ID ) timeline[me3delay].push_back(3);
139  if( me4ID ) timeline[me4delay].push_back(4);
140  int earliest_tbin=0, second_earliest_tbin=0;
141  for(int bx=7; bx>=0; bx--){
142  std::list<int>::const_iterator iter = timeline[bx].begin();
143  while( iter != timeline[bx].end() ){
144  if( earliest_tbin==0 ) earliest_tbin=bx;
145  else if( second_earliest_tbin==0 ) second_earliest_tbin=bx;
146  iter++;
147  }
148  }
149  // Core's input was loaded in a relative time window BX=[0-7)
150  // To relate it to time window of tracks (centred at BX=0) we introduce a shift:
151  int shift = (m_maxBX + m_minBX)/2 - m_minBX + m_minBX;
152  int me1Tbin = titr->bx() - me1delay + second_earliest_tbin + shift;
153  int me2Tbin = titr->bx() - me2delay + second_earliest_tbin + shift;
154  int me3Tbin = titr->bx() - me3delay + second_earliest_tbin + shift;
155  int me4Tbin = titr->bx() - me4delay + second_earliest_tbin + shift;
156  int mb1Tbin = titr->bx() - mb1delay + second_earliest_tbin + shift;
157 
158  for(; tkstbs != possible_stubs.end(); tkstbs++)
159  {
160  switch(tkstbs->station())
161  {
162  case 1:
163  if((tkstbs->getMPCLink()
164  +(3*(CSCTriggerNumbering::triggerSubSectorFromLabels(CSCDetId(tkstbs->getDetId().rawId())) - 1))) == me1ID && me1ID != 0 && me1Tbin == tkstbs->BX() )
165  {
166  tcitr->second.insertDigi(CSCDetId(tkstbs->getDetId().rawId()), *(tkstbs->getDigi()));
167  }
168  break;
169  case 2:
170  if(tkstbs->getMPCLink() == me2ID && me2ID != 0 && me2Tbin == tkstbs->BX() )
171  {
172  tcitr->second.insertDigi(CSCDetId(tkstbs->getDetId().rawId()), *(tkstbs->getDigi()));
173  }
174  break;
175  case 3:
176  if(tkstbs->getMPCLink() == me3ID && me3ID != 0 && me3Tbin == tkstbs->BX() )
177  {
178  tcitr->second.insertDigi(CSCDetId(tkstbs->getDetId().rawId()), *(tkstbs->getDigi()));
179  }
180  break;
181  case 4:
182  if(tkstbs->getMPCLink() == me4ID && me4ID != 0 && me4Tbin == tkstbs->BX() )
183  {
184  tcitr->second.insertDigi(CSCDetId(tkstbs->getDetId().rawId()), *(tkstbs->getDigi()));
185  }
186  break;
187  case 5:
188  if(tkstbs->getMPCLink() == mb1ID && mb1ID != 0 && mb1Tbin == tkstbs->BX() )
189  {
191  }
192  break;
193  default:
194  edm::LogWarning("CSCTFTrackBuilder::buildTracks()") << "SERIOUS ERROR: STATION " << tkstbs->station() << " NOT IN RANGE [1,5]\n";
195  };
196  }
197  tcitr++; // increment to next track in the collection
198  }
199 
200 }
std::vector< csctf::TrackStub > filteredStubs() const
std::vector< T > get() const
static int minEndcapId()
Definition: CSCDetId.h:249
static int maxTriggerSectorId()
static int minTriggerSectorId()
void push_back(const T &data)
int run(const CSCTriggerContainer< csctf::TrackStub > &)
static int maxEndcapId()
Definition: CSCDetId.h:250
#define end
Definition: vmac.h:37
void push_many(const std::vector< T > &data)
std::vector< CSCCorrelatedLCTDigi >::const_iterator const_iterator
static int triggerSubSectorFromLabels(int station, int chamber)
CSCTriggerContainer< csc::L1Track > tracks() const
static unsigned int const shift
CSCTFSectorProcessor * my_SPs[nEndcaps][nSectors]
void CSCTFTrackBuilder::initialize ( const edm::EventSetup c)

Definition at line 36 of file CSCTFTrackBuilder.cc.

References alignCSCRings::e, CSCTFSectorProcessor::initialize(), CSCDetId::maxEndcapId(), CSCTriggerNumbering::maxTriggerSectorId(), CSCDetId::minEndcapId(), CSCTriggerNumbering::minTriggerSectorId(), my_SPs, and alignCSCRings::s.

Referenced by CSCTFTrackProducer::produce().

36  {
37  //my_dtrc->initialize(c);
38  for(int e = CSCDetId::minEndcapId(); e <= CSCDetId::maxEndcapId(); ++e)
39  {
41  {
42  my_SPs[e-1][s-1]->initialize(c);
43  }
44  }
45 }
static int minEndcapId()
Definition: CSCDetId.h:249
static int maxTriggerSectorId()
void initialize(const edm::EventSetup &c)
KK.
static int minTriggerSectorId()
static int maxEndcapId()
Definition: CSCDetId.h:250
CSCTFSectorProcessor * my_SPs[nEndcaps][nSectors]

Member Data Documentation

int CSCTFTrackBuilder::m_maxBX
private

Definition at line 39 of file CSCTFTrackBuilder.h.

Referenced by buildTracks(), and CSCTFTrackBuilder().

int CSCTFTrackBuilder::m_minBX
private

Definition at line 39 of file CSCTFTrackBuilder.h.

Referenced by buildTracks(), and CSCTFTrackBuilder().

CSCTFSectorProcessor* CSCTFTrackBuilder::my_SPs[nEndcaps][nSectors]
private

Definition at line 38 of file CSCTFTrackBuilder.h.

Referenced by buildTracks(), CSCTFTrackBuilder(), initialize(), and ~CSCTFTrackBuilder().