CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CSCTFAnalyzer Class Reference

#include <CSCTFAnalyzer.h>

Inheritance diagram for CSCTFAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
 CSCTFAnalyzer (const edm::ParameterSet &conf)
 
 ~CSCTFAnalyzer (void) override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< CSCCorrelatedLCTDigiCollectionCSCCDC_Tok
 
edm::EDGetTokenT< CSCTriggerContainer< csctf::TrackStub > > CSCTC_Tok
 
int dtPhi [12][2]
 
TFile * file
 
edm::EDGetTokenT< L1CSCStatusDigiCollectionL1CSCS_Tok
 
edm::EDGetTokenT< L1CSCTrackCollectionL1CST_Tok
 
edm::InputTag lctProducer
 
edm::InputTag mbProducer
 
edm::InputTag statusProducer
 
edm::InputTag trackProducer
 
TTree * tree
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 21 of file CSCTFAnalyzer.h.

Constructor & Destructor Documentation

CSCTFAnalyzer::CSCTFAnalyzer ( const edm::ParameterSet conf)
explicit

Definition at line 12 of file CSCTFAnalyzer.cc.

References CSCCDC_Tok, CSCTC_Tok, dtPhi, file, edm::ParameterSet::getUntrackedParameter(), edm::InputTag::instance(), L1CSCS_Tok, L1CST_Tok, edm::InputTag::label(), lctProducer, mbProducer, statusProducer, and trackProducer.

12  :edm::EDAnalyzer(){
13  mbProducer = conf.getUntrackedParameter<edm::InputTag>("mbProducer",edm::InputTag("csctfunpacker"));
14  lctProducer = conf.getUntrackedParameter<edm::InputTag>("lctProducer",edm::InputTag("csctfunpacker"));
15  trackProducer = conf.getUntrackedParameter<edm::InputTag>("trackProducer",edm::InputTag("csctfunpacker"));
16  statusProducer= conf.getUntrackedParameter<edm::InputTag>("statusProducer",edm::InputTag("csctfunpacker"));
17  file = new TFile("ewq.root","RECREATE");
18  tree = new TTree("dy","QWE");
19  tree->Branch("dtPhi_1_plus",&dtPhi[0][0],"dtPhi_1_plus/I");
20  tree->Branch("dtPhi_2_plus",&dtPhi[1][0],"dtPhi_2_plus/I");
21  tree->Branch("dtPhi_3_plus",&dtPhi[2][0],"dtPhi_3_plus/I");
22  tree->Branch("dtPhi_4_plus",&dtPhi[3][0],"dtPhi_4_plus/I");
23  tree->Branch("dtPhi_5_plus",&dtPhi[4][0],"dtPhi_5_plus/I");
24  tree->Branch("dtPhi_6_plus",&dtPhi[5][0],"dtPhi_6_plus/I");
25  tree->Branch("dtPhi_7_plus",&dtPhi[6][0],"dtPhi_7_plus/I");
26  tree->Branch("dtPhi_8_plus",&dtPhi[7][0],"dtPhi_8_plus/I");
27  tree->Branch("dtPhi_9_plus",&dtPhi[8][0],"dtPhi_9_plus/I");
28  tree->Branch("dtPhi_10_plus",&dtPhi[9][0],"dtPhi_10_plus/I");
29  tree->Branch("dtPhi_11_plus",&dtPhi[10][0],"dtPhi_11_plus/I");
30  tree->Branch("dtPhi_12_plus",&dtPhi[11][0],"dtPhi_12_plus/I");
31  tree->Branch("dtPhi_1_minus",&dtPhi[0][1],"dtPhi_1_minus/I");
32  tree->Branch("dtPhi_2_minus",&dtPhi[1][1],"dtPhi_2_minus/I");
33  tree->Branch("dtPhi_3_minus",&dtPhi[2][1],"dtPhi_3_minus/I");
34  tree->Branch("dtPhi_4_minus",&dtPhi[3][1],"dtPhi_4_minus/I");
35  tree->Branch("dtPhi_5_minus",&dtPhi[4][1],"dtPhi_5_minus/I");
36  tree->Branch("dtPhi_6_minus",&dtPhi[5][1],"dtPhi_6_minus/I");
37  tree->Branch("dtPhi_7_minus",&dtPhi[6][1],"dtPhi_7_minus/I");
38  tree->Branch("dtPhi_8_minus",&dtPhi[7][1],"dtPhi_8_minus/I");
39  tree->Branch("dtPhi_9_minus",&dtPhi[8][1],"dtPhi_9_minus/I");
40  tree->Branch("dtPhi_10_minus",&dtPhi[9][1],"dtPhi_10_minus/I");
41  tree->Branch("dtPhi_11_minus",&dtPhi[10][1],"dtPhi_11_minus/I");
42  tree->Branch("dtPhi_12_minus",&dtPhi[11][1],"dtPhi_12_minus/I");
43 
44 
45  L1CSCS_Tok = consumes<L1CSCStatusDigiCollection>( edm::InputTag(statusProducer.label(),statusProducer.instance() ) );
46  CSCTC_Tok = consumes<CSCTriggerContainer<csctf::TrackStub> >( edm::InputTag(mbProducer.label(),mbProducer.instance()) );
47  CSCCDC_Tok = consumes<CSCCorrelatedLCTDigiCollection>( edm::InputTag(lctProducer.label(),lctProducer.instance()) );
48  L1CST_Tok = consumes<L1CSCTrackCollection>( edm::InputTag(trackProducer.label(),trackProducer.instance()) );
49 
50 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< CSCTriggerContainer< csctf::TrackStub > > CSCTC_Tok
Definition: CSCTFAnalyzer.h:29
edm::InputTag mbProducer
Definition: CSCTFAnalyzer.h:23
edm::InputTag lctProducer
Definition: CSCTFAnalyzer.h:23
edm::InputTag statusProducer
Definition: CSCTFAnalyzer.h:23
edm::InputTag trackProducer
Definition: CSCTFAnalyzer.h:23
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > CSCCDC_Tok
Definition: CSCTFAnalyzer.h:30
std::string const & label() const
Definition: InputTag.h:36
int dtPhi[12][2]
Definition: CSCTFAnalyzer.h:26
Definition: tree.py:1
edm::EDGetTokenT< L1CSCTrackCollection > L1CST_Tok
Definition: CSCTFAnalyzer.h:31
std::string const & instance() const
Definition: InputTag.h:37
edm::EDGetTokenT< L1CSCStatusDigiCollection > L1CSCS_Tok
Definition: CSCTFAnalyzer.h:28
CSCTFAnalyzer::~CSCTFAnalyzer ( void  )
inlineoverride

Definition at line 38 of file CSCTFAnalyzer.h.

38 { file->cd(); tree->Write(); file->Close(); }
Definition: tree.py:1

Member Function Documentation

void CSCTFAnalyzer::analyze ( const edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 52 of file CSCTFAnalyzer.cc.

References gather_cfg::cout, CSCCDC_Tok, CSCTC_Tok, dtPhi, edm::Event::getByToken(), edm::HandleBase::isValid(), L1CSCS_Tok, L1CST_Tok, edm::InputTag::label(), lctProducer, mbProducer, edm::Handle< T >::product(), relativeConstraints::station, mps_update::status, statusProducer, trackProducer, l1t::tracks, and CSCTriggerNumbering::triggerSubSectorFromLabels().

52  {
53 /* edm::Handle<FEDRawDataCollection> rawdata;
54  e.getByToken("source","",rawdata);
55 
56  const FEDRawData& fedData = rawdata->FEDData(750);
57  if( fedData.size()==0 ) return;
58  unsigned short *data = (unsigned short *)fedData.data();
59  unsigned int size = fedData.size()/2;
60  std::cout<<"New event:"<<std::endl;
61  for(unsigned i=0; i<size/4; i++)
62  std::cout<<std::hex<<" "<<std::setw(6)<<data[i*4+0]<<" "<<std::setw(6)<<data[i*4+1]<<" "<<std::setw(6)<<data[i*4+2]<<" "<<std::setw(6)<<data[i*4+3]<<std::dec<<std::endl;
63  std::cout<<"End of event"<<std::endl;
64  return;
65 */
66  if( statusProducer.label() != "null" ){
68  e.getByToken(L1CSCS_Tok ,status);
69  if( status.isValid() ){
70  edm::LogInfo("CSCTFAnalyzer") << " Unpacking Errors: "<<status->first;
71  for(std::vector<L1CSCSPStatusDigi>::const_iterator stat=status->second.begin();
72  stat!=status->second.end(); stat++){
73  //edm::LogInfo("CSCTFAnalyzer") << " Status: SP in slot "<<stat->slot()<<" FMM: "<<stat->FMM()<<" SE: 0x"<<std::hex<<stat->SEs()<<" VP: 0x"<<stat->VPs()<<std::dec;
74  }
75  } else edm::LogInfo("CSCTFAnalyzer")<<" No valid L1CSCStatusDigiCollection products found";
76  }
77 
78  if( mbProducer.label() != "null" ){
79  bzero(dtPhi,sizeof(dtPhi));
81  e.getByToken(CSCTC_Tok ,dtStubs);
82  if( dtStubs.isValid() ){
83  std::vector<csctf::TrackStub> vstubs = dtStubs->get();
84  std::cout<<"DT size="<<vstubs.end()-vstubs.begin()<<std::endl;
85  for(std::vector<csctf::TrackStub>::const_iterator stub=vstubs.begin(); stub!=vstubs.end(); stub++){
86  int dtSector =(stub->sector()-1)*2 + stub->subsector()-1;
87  int dtEndcap = stub->endcap()-1;
88  if( dtSector>=0 && dtSector<12 && dtEndcap>=0 && dtEndcap<2 ){
89  dtPhi[dtSector][dtEndcap] = stub->phiPacked();
90  } else {
91  edm::LogInfo("CSCTFAnalyzer: DT digi are out of range: ")<<" dtSector="<<dtSector<<" dtEndcap="<<dtEndcap;
92  }
93  edm::LogInfo("CSCTFAnalyzer")<<" DT data: tbin="<<stub->BX()<<" CSC sector="<<stub->sector()<<" CSC subsector="<<stub->subsector()<<" station="<<stub->station()<<" endcap="<<stub->endcap()
94  <<" phi="<<stub->phiPacked()<<" phiBend="<<stub->getBend()<<" quality="<<stub->getQuality()<<" mb_bxn="<<stub->cscid();
95  }
96  } else edm::LogInfo("CSCTFAnalyzer")<<" No valid CSCTriggerContainer<csctf::TrackStub> products found";
97  tree->Fill();
98  }
99 
100  if( lctProducer.label() != "null" ){
102  e.getByToken(CSCCDC_Tok ,corrlcts);
103  if( corrlcts.isValid() ){
104  for(CSCCorrelatedLCTDigiCollection::DigiRangeIterator csc=corrlcts.product()->begin(); csc!=corrlcts.product()->end(); csc++){
105  int lctId=0;
106  CSCCorrelatedLCTDigiCollection::Range range1 = corrlcts.product()->get((*csc).first);
107  for(CSCCorrelatedLCTDigiCollection::const_iterator lct=range1.first; lct!=range1.second; lct++,lctId++){
108  int station = (*csc).first.station()-1;
109  int cscId = (*csc).first.triggerCscId()-1;
110  int sector = (*csc).first.triggerSector()-1;// + ( (*csc).first.endcap()==1 ? 0 : 6 );
111  int subSector = CSCTriggerNumbering::triggerSubSectorFromLabels((*csc).first);
112  int tbin = lct->getBX();
113  int fpga = ( subSector ? subSector-1 : station+1 );
114  // If Det Id is within range
115  if( sector<0 || sector>11 || station<0 || station>3 || cscId<0 || cscId>8 || lctId<0 || lctId>1){
116  edm::LogInfo("CSCTFAnalyzer: CSC digi are out of range: ");
117  continue;
118  }
119  edm::LogInfo("CSCTFAnalyzer")<<" Front data endcap: "<<(*csc).first.endcap()<<" station: "<<(station+1)<<" sector: "<<(sector+1)<<" subSector: "<<subSector<<" tbin: "<<tbin<<" cscId: "<<(cscId+1)<<" fpga: "<<(fpga+1)<<" "<<
120  "LCT(vp="<<lct->isValid()<<",qual="<<lct->getQuality()<<",wg="<<lct->getKeyWG()<<",strip="<<lct->getStrip()<<",link="<<lct->getMPCLink()<<")";
121  }
122  }
123  } else edm::LogInfo("CSCTFAnalyzer")<<" No valid CSCCorrelatedLCTDigiCollection products found";
124  }
125 
126  if( trackProducer.label() != "null" ){
128  e.getByToken(L1CST_Tok ,tracks);
129  if( tracks.isValid() ){
130  int nTrk=0;
131  for(L1CSCTrackCollection::const_iterator trk=tracks->begin(); trk<tracks->end(); trk++,nTrk++){
132  int sector = 6*(trk->first.endcap()-1)+trk->first.sector()-1;
133  int tbin = trk->first.BX();
134  edm::LogInfo("CSCTFAnalyzer") << " Track sector: "<<(sector+1)<<" tbin: "<<tbin<<" "<<
135  "TRK(mode="<<((trk->first.ptLUTAddress()>>16)&0xF)<<",eta="<<trk->first.eta_packed()<<",phi="<<trk->first.localPhi()<<") IDs:"
136  <<" me1D="<<trk->first.me1ID()<<" t1="<<trk->first.me1Tbin()
137  <<" me2D="<<trk->first.me2ID()<<" t2="<<trk->first.me2Tbin()
138  <<" me3D="<<trk->first.me3ID()<<" t3="<<trk->first.me3Tbin()
139  <<" me4D="<<trk->first.me4ID()<<" t4="<<trk->first.me4Tbin()
140  <<" mb1D="<<trk->first.mb1ID()<<" tb="<<trk->first.mb1Tbin();
141 
142  for(CSCCorrelatedLCTDigiCollection::DigiRangeIterator csc=trk->second.begin(); csc!=trk->second.end(); csc++){
143  int lctId=0;
144  CSCCorrelatedLCTDigiCollection::Range range1 = trk->second.get((*csc).first);
145  for(CSCCorrelatedLCTDigiCollection::const_iterator lct=range1.first; lct!=range1.second; lct++,lctId++){
146  int station = (*csc).first.station()-1;
147  int cscId = (*csc).first.triggerCscId()-1;
148  int sector = (*csc).first.triggerSector()-1;// + ( (*csc).first.endcap()==1 ? 0 : 6 );
149  int subSector = CSCTriggerNumbering::triggerSubSectorFromLabels((*csc).first);
150  int tbin = lct->getBX();
151  int fpga = ( subSector ? subSector-1 : station+1 );
152  // If Det Id is within range
153  if( sector<0 || sector>11 || station<0 || station>3 || cscId<0 || cscId>8 || lctId<0 || lctId>1){
154  edm::LogInfo("CSCTFAnalyzer: Digi are out of range: ");
155  continue;
156  }
157  if( lct->getQuality() < 100 )
158  edm::LogInfo("CSCTFAnalyzer")<<" Linked LCT: "<<(*csc).first.endcap()<<" station: "<<(station+1)<<" sector: "<<(sector+1)<<" subSector: "<<subSector<<" tbin: "<<tbin
159  <<" cscId: "<<(cscId+1)<<" fpga: "<<(fpga+1)<<" LCT(vp="<<lct->isValid()<<",qual="<<lct->getQuality()<<",wg="<<lct->getKeyWG()<<",strip="<<lct->getStrip()<<")";
160  else
161  edm::LogInfo("CSCTFAnalyzer")<<" Linked MB stub: "<<(*csc).first.endcap()<<" sector: "<<(sector+1)<<" subSector: "<<subSector<<" tbin: "<<tbin
162  <<" MB(vp="<<lct->isValid()<<",qual="<<(lct->getQuality()-100)<<",cal="<<lct->getKeyWG()<<",flag="<<lct->getStrip()<<",bc0="<<lct->getPattern()<<",phiBend="<<lct->getBend()
163  <<",tbin="<<lct->getBX()<<",id="<<lct->getMPCLink()<<",bx0="<<lct->getBX0()<<",se="<<lct->getSyncErr()<<",bxn="<<lct->getCSCID()<<",phi="<<lct->getTrknmb()<<")";
164  }
165  }
166  }
167  } else edm::LogInfo("CSCTFAnalyzer")<<" No valid L1CSCTrackCollection products found";
168  }
169 }
edm::EDGetTokenT< CSCTriggerContainer< csctf::TrackStub > > CSCTC_Tok
Definition: CSCTFAnalyzer.h:29
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
edm::InputTag mbProducer
Definition: CSCTFAnalyzer.h:23
edm::InputTag lctProducer
Definition: CSCTFAnalyzer.h:23
edm::InputTag statusProducer
Definition: CSCTFAnalyzer.h:23
bool isValid() const
Definition: HandleBase.h:74
Definition: L1Track.h:19
edm::InputTag trackProducer
Definition: CSCTFAnalyzer.h:23
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > CSCCDC_Tok
Definition: CSCTFAnalyzer.h:30
T const * product() const
Definition: Handle.h:81
std::vector< CSCCorrelatedLCTDigi >::const_iterator const_iterator
static int triggerSubSectorFromLabels(int station, int chamber)
std::string const & label() const
Definition: InputTag.h:36
int dtPhi[12][2]
Definition: CSCTFAnalyzer.h:26
std::pair< const_iterator, const_iterator > Range
Definition: tree.py:1
edm::EDGetTokenT< L1CSCTrackCollection > L1CST_Tok
Definition: CSCTFAnalyzer.h:31
edm::EDGetTokenT< L1CSCStatusDigiCollection > L1CSCS_Tok
Definition: CSCTFAnalyzer.h:28

Member Data Documentation

edm::EDGetTokenT<CSCCorrelatedLCTDigiCollection> CSCTFAnalyzer::CSCCDC_Tok
private

Definition at line 30 of file CSCTFAnalyzer.h.

Referenced by analyze(), and CSCTFAnalyzer().

edm::EDGetTokenT<CSCTriggerContainer<csctf::TrackStub> > CSCTFAnalyzer::CSCTC_Tok
private

Definition at line 29 of file CSCTFAnalyzer.h.

Referenced by analyze(), and CSCTFAnalyzer().

int CSCTFAnalyzer::dtPhi[12][2]
private

Definition at line 26 of file CSCTFAnalyzer.h.

Referenced by analyze(), and CSCTFAnalyzer().

TFile* CSCTFAnalyzer::file
private

Definition at line 25 of file CSCTFAnalyzer.h.

Referenced by CSCTFAnalyzer().

edm::EDGetTokenT<L1CSCStatusDigiCollection> CSCTFAnalyzer::L1CSCS_Tok
private

Definition at line 28 of file CSCTFAnalyzer.h.

Referenced by analyze(), and CSCTFAnalyzer().

edm::EDGetTokenT<L1CSCTrackCollection> CSCTFAnalyzer::L1CST_Tok
private

Definition at line 31 of file CSCTFAnalyzer.h.

Referenced by analyze(), and CSCTFAnalyzer().

edm::InputTag CSCTFAnalyzer::lctProducer
private

Definition at line 23 of file CSCTFAnalyzer.h.

Referenced by analyze(), and CSCTFAnalyzer().

edm::InputTag CSCTFAnalyzer::mbProducer
private

Definition at line 23 of file CSCTFAnalyzer.h.

Referenced by analyze(), and CSCTFAnalyzer().

edm::InputTag CSCTFAnalyzer::statusProducer
private

Definition at line 23 of file CSCTFAnalyzer.h.

Referenced by analyze(), and CSCTFAnalyzer().

edm::InputTag CSCTFAnalyzer::trackProducer
private

Definition at line 23 of file CSCTFAnalyzer.h.

Referenced by analyze(), and CSCTFAnalyzer().

TTree* CSCTFAnalyzer::tree
private