CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
CSCTriggerPrimitivesReader Class Reference

#include <CSCTriggerPrimitivesReader.h>

Inheritance diagram for CSCTriggerPrimitivesReader:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup)
 Does the job. More...
 
int chamberIX (CSCDetId id)
 
int chamberIXi (CSCDetId id)
 
int chamberSerial (CSCDetId id)
 
 CSCTriggerPrimitivesReader (const edm::ParameterSet &conf)
 Constructor. More...
 
void endJob ()
 Write to ROOT file, make plots, etc. More...
 
void HotWires (const edm::Event &iEvent)
 
virtual ~CSCTriggerPrimitivesReader ()
 Destructor. More...
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

enum  { MAXPAGES = 20 }
 
enum  trig_cscs { MAX_ENDCAPS = 2, MAX_STATIONS = 4, CSC_TYPES = 10 }
 

Private Member Functions

void bookALCTHistos ()
 
void bookCLCTHistos ()
 
void bookCompHistos ()
 
void bookEfficHistos ()
 
void bookHotWireHistos ()
 
void bookLCTMPCHistos ()
 
void bookLCTTMBHistos ()
 
void bookResolHistos ()
 
void calcEfficiency (const CSCALCTDigiCollection *alcts, const CSCCLCTDigiCollection *clcts, const edm::PSimHitContainer &allSimHits)
 
void calcResolution (const CSCALCTDigiCollection *alcts, const CSCCLCTDigiCollection *clcts, const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const edm::PSimHitContainer &allSimHits)
 
void compare (const CSCALCTDigiCollection *alcts_data, const CSCALCTDigiCollection *alcts_emul, const CSCCLCTDigiCollection *clcts_data, const CSCCLCTDigiCollection *clcts_emul, const CSCCLCTPreTriggerDigiCollection *pretrigs_emul, const CSCCorrelatedLCTDigiCollection *lcts_data, const CSCCorrelatedLCTDigiCollection *lcts_emul)
 
void compareALCTs (const CSCALCTDigiCollection *alcts_data, const CSCALCTDigiCollection *alcts_emul)
 
void compareCLCTs (const CSCCLCTDigiCollection *clcts_data, const CSCCLCTDigiCollection *clcts_emul, const CSCCLCTPreTriggerDigiCollection *pretrigs_emul)
 
void compareLCTs (const CSCCorrelatedLCTDigiCollection *lcts_data, const CSCCorrelatedLCTDigiCollection *lcts_emul, const CSCALCTDigiCollection *alcts_data, const CSCCLCTDigiCollection *clcts_data)
 
void compareMPCLCTs (const CSCCorrelatedLCTDigiCollection *lcts_data, const CSCCorrelatedLCTDigiCollection *lcts_emul, const CSCALCTDigiCollection *alcts_data, const CSCCLCTDigiCollection *clcts_data)
 
int convertBXofLCT (const int emul_bx, const CSCDetId &detid, const CSCALCTDigiCollection *alcts_data, const CSCCLCTDigiCollection *clcts_data)
 
bool doesALCTCrossCLCT (CSCDetId id, int key_wg, int key_hs) const
 
void drawALCTHistos ()
 
void drawCLCTHistos ()
 
void drawCompHistos ()
 
void drawEfficHistos ()
 
void drawHistosForTalks ()
 
void drawLCTMPCHistos ()
 
void drawLCTTMBHistos ()
 
void drawResolHistos ()
 
void fillALCTHistos (const CSCALCTDigiCollection *alcts)
 
void fillCLCTHistos (const CSCCLCTDigiCollection *clcts)
 
void fillLCTMPCHistos (const CSCCorrelatedLCTDigiCollection *lcts)
 
void fillLCTTMBHistos (const CSCCorrelatedLCTDigiCollection *lcts)
 
int getCSCType (const CSCDetId &id)
 
GlobalPoint getGlobalPosition (unsigned int rawId, int keWg, int keyHS) const
 
double getHsPerRad (const int idh)
 
int maxRing (int station)
 
void MCStudies (const edm::Event &ev, const CSCALCTDigiCollection *alcts, const CSCCLCTDigiCollection *clcts)
 
void setRootStyle ()
 

Private Attributes

edm::EDGetTokenT< CSCALCTDigiCollectionalcts_d_token_
 
edm::EDGetTokenT< CSCALCTDigiCollectionalcts_e_token_
 
const CSCBadChambersbadChambers_
 
bool checkBadChambers_
 
edm::EDGetTokenT< CSCCLCTDigiCollectionclcts_d_token_
 
edm::EDGetTokenT< CSCCLCTDigiCollectionclcts_e_token_
 
edm::EDGetTokenT< CSCComparatorDigiCollectioncompDigi_token_
 
edm::InputTag compDigiProducer_
 
bool dataIsAnotherMC_
 
bool dataLctsIn_
 
bool debug
 
bool emulLctsIn_
 
int Event_
 
TTree * event_tree [6]
 
int eventsAnalyzed
 
bool gangedME1a
 
const CSCGeometrygeom_
 
TH1F * hAlctAccel
 
TH1F * hAlctBXN
 
TH1F * hAlctCollis
 
TH1F * hAlctCompFound
 
TH2F * hAlctCompFound2
 
TH2F * hAlctCompFound2i
 
TH2F * hAlctCompFound2x
 
TH1F * hAlctCompFoundCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hAlctCompMatch
 
TH2F * hAlctCompMatch2
 
TH2F * hAlctCompMatch2i
 
TH2F * hAlctCompMatch2x
 
TH1F * hAlctCompMatchCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hAlctCompSameN
 
TH2F * hAlctCompSameN2
 
TH2F * hAlctCompSameN2i
 
TH2F * hAlctCompSameN2x
 
TH1F * hAlctCompSameNCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hAlctCompTotal
 
TH2F * hAlctCompTotal2
 
TH2F * hAlctCompTotal2i
 
TH2F * hAlctCompTotal2x
 
TH1F * hAlctCompTotalCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hAlctCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hAlctKeyGroup
 
TH1F * hAlctKeyGroupME11
 
TH1F * hAlctPerChamber
 
TH1F * hAlctPerCSC
 
TH1F * hAlctPerEvent
 
TH1F * hAlctQuality
 
TH1F * hAlctValid
 
TH1F * hAlctVsEta [MAX_STATIONS]
 
TH1F * hClctBendCsc [CSC_TYPES][2]
 
TH1F * hClctBXN
 
TH1F * hClctCFEB
 
TH1F * hClctCompFound
 
TH2F * hClctCompFound2
 
TH2F * hClctCompFound2i
 
TH2F * hClctCompFound2x
 
TH1F * hClctCompFoundCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hClctCompMatch
 
TH2F * hClctCompMatch2
 
TH2F * hClctCompMatch2i
 
TH2F * hClctCompMatch2x
 
TH1F * hClctCompMatchCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hClctCompSameN
 
TH2F * hClctCompSameN2
 
TH2F * hClctCompSameN2i
 
TH2F * hClctCompSameN2x
 
TH1F * hClctCompSameNCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hClctCompTotal
 
TH2F * hClctCompTotal2
 
TH2F * hClctCompTotal2i
 
TH2F * hClctCompTotal2x
 
TH1F * hClctCompTotalCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hClctCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hClctKeyStrip [2]
 
TH1F * hClctKeyStripCsc [CSC_TYPES]
 
TH1F * hClctKeyStripME11
 
TH1F * hClctPattern [2]
 
TH1F * hClctPerChamber
 
TH1F * hClctPerCSC
 
TH1F * hClctPerEvent
 
TH1F * hClctQuality
 
TH1F * hClctSign
 
TH1F * hClctStripType
 
TH1F * hClctValid
 
TH1F * hClctVsPhi [MAX_STATIONS]
 
TH1F * hCorrLctMPCPerCSC
 
TH1F * hCorrLctTMBPerCSC
 
TH1F * hEfficALCTEta [MAX_STATIONS]
 
TH1F * hEfficALCTEtaCsc [CSC_TYPES]
 
TH1F * hEfficCLCTEta [MAX_STATIONS]
 
TH1F * hEfficCLCTEtaCsc [CSC_TYPES]
 
TH1F * hEfficHitsEta [MAX_STATIONS]
 
TH1F * hEfficHitsEtaCsc [CSC_TYPES]
 
TH1F * hEtaDiffCsc [CSC_TYPES][3]
 
TH1F * hEtaDiffVsEta [MAX_STATIONS]
 
TH2F * hEtaDiffVsWireCsc [CSC_TYPES]
 
TH2F * hEtaRecVsSim
 
TH1F * hHotCham1
 
TH1F * hHotWire1
 
TH1F * hLCTCompFound
 
TH2F * hLCTCompFound2
 
TH2F * hLCTCompFound2i
 
TH2F * hLCTCompFound2x
 
TH1F * hLctCompFoundCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hLCTCompMatch
 
TH2F * hLCTCompMatch2
 
TH2F * hLCTCompMatch2i
 
TH2F * hLCTCompMatch2x
 
TH1F * hLctCompMatchCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hLCTCompSameN
 
TH2F * hLCTCompSameN2
 
TH2F * hLCTCompSameN2i
 
TH2F * hLCTCompSameN2x
 
TH1F * hLctCompSameNCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hLCTCompTotal
 
TH2F * hLCTCompTotal2
 
TH2F * hLCTCompTotal2i
 
TH2F * hLCTCompTotal2x
 
TH1F * hLctCompTotalCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hLctMPCBend
 
TH1F * hLctMPCBXN
 
TH1F * hLctMPCChamber [MAX_STATIONS]
 
TH1F * hLctMPCEndcap
 
TH1F * hLctMPCKeyGroup
 
TH1F * hLctMPCKeyGroupME11
 
TH1F * hLctMPCKeyStrip
 
TH1F * hLctMPCKeyStripME11
 
TH1F * hLctMPCPattern
 
TH1F * hLctMPCPerCSC
 
TH1F * hLctMPCPerEvent
 
TH1F * hLctMPCQuality
 
TH1F * hLctMPCRing
 
TH1F * hLctMPCSector
 
TH1F * hLctMPCStation
 
TH1F * hLctMPCStripType
 
TH1F * hLctMPCValid
 
TH1F * hLctTMBBend
 
TH1F * hLctTMBBXN
 
TH1F * hLctTMBChamber [MAX_STATIONS]
 
TH1F * hLctTMBCsc [MAX_ENDCAPS][CSC_TYPES]
 
TH1F * hLctTMBEndcap
 
TH1F * hLctTMBKeyGroup
 
TH1F * hLctTMBKeyGroupME11
 
TH1F * hLctTMBKeyStrip
 
TH1F * hLctTMBKeyStripME11
 
TH1F * hLctTMBPattern
 
TH1F * hLctTMBPerChamber
 
TH1F * hLctTMBPerCSC
 
TH1F * hLctTMBPerEvent
 
TH1F * hLctTMBQuality
 
TH1F * hLctTMBRing
 
TH1F * hLctTMBSector
 
TH1F * hLctTMBStation
 
TH1F * hLctTMBStripType
 
TH1F * hLctTMBValid
 
TH1F * hPhiDiffCsc [CSC_TYPES][5]
 
TH1F * hPhiDiffPattern [CSCConstants::NUM_CLCT_PATTERNS]
 
TH1F * hPhiDiffVsPhi [MAX_STATIONS]
 
TH2F * hPhiDiffVsStripCsc [CSC_TYPES][2]
 
TH2F * hPhiRecVsSim
 
TH1F * hResolDeltaDS
 
TH1F * hResolDeltaEta
 
TH1F * hResolDeltaHS
 
TH1F * hResolDeltaPhi
 
TH1F * hResolDeltaPhiDS
 
TH1F * hResolDeltaPhiHS
 
TH1F * hResolDeltaWG
 
TH1F * hTrueBendCsc [CSC_TYPES]
 
std::string lctProducerData_
 
std::string lctProducerEmul_
 
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollectionlcts_mpc_d_token_
 
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollectionlcts_mpc_e_token_
 
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollectionlcts_tmb_d_token_
 
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollectionlcts_tmb_e_token_
 
std::string mpclctProducerData_
 
TreePerStub perStub [6]
 
bool plotME1A
 
bool plotME42
 
edm::EDGetTokenT< CSCCLCTPreTriggerDigiCollectionpretrigs_e_token_
 
std::string resultsFileNamesPrefix_
 
std::string rootFileName
 
int RUN_
 
edm::EDGetTokenT< edm::PSimHitContainersimHit_token_
 
edm::InputTag simHitProducer_
 
TTree * stub_tree [4]
 
MyStubComparison stubs_comparison [4]
 
edm::EDGetTokenT< CSCWireDigiCollectionwireDigi_token_
 
edm::InputTag wireDigiProducer_
 

Static Private Attributes

static bool bookedALCTHistos = false
 
static bool bookedCLCTHistos = false
 
static bool bookedCompHistos = false
 
static bool bookedEfficHistos = false
 
static bool bookedHotWireHistos = false
 
static bool bookedLCTMPCHistos = false
 
static bool bookedLCTTMBHistos = false
 
static bool bookedResolHistos = false
 
static const std::string csc_type [CSC_TYPES]
 
static const std::string csc_type_minus [CSC_TYPES]
 
static const std::string csc_type_plus [CSC_TYPES]
 
static const int lut_wg_vs_hs_me1a [48][2]
 
static const int lut_wg_vs_hs_me1ag [48][2]
 
static const int lut_wg_vs_hs_me1b [48][2]
 
static const int MAX_HS [CSC_TYPES]
 
static const int MAX_WG [CSC_TYPES]
 
static const int NCHAMBERS [CSC_TYPES]
 
static int numALCT = 0
 
static int numCLCT = 0
 
static int numLCTMPC = 0
 
static int numLCTTMB = 0
 
static bool printps = false
 
static const int ptype_TMB07 [CSCConstants::NUM_CLCT_PATTERNS]
 
static const double TWOPI = 2.*M_PI
 

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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Basic analyzer class which accesses ALCTs, CLCTs, and correlated LCTs and plot various quantities.

Author
Slava Valuev, UCLA.

Definition at line 122 of file CSCTriggerPrimitivesReader.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
MAXPAGES 

Definition at line 206 of file CSCTriggerPrimitivesReader.h.

206 {MAXPAGES = 20}; // max. number of pages in postscript files

Constructor & Destructor Documentation

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

Constructor.

Definition at line 303 of file CSCTriggerPrimitivesReader.cc.

References alcts_d_token_, alcts_e_token_, TreePerStub::bookTree(), MyStubComparison::bookTree(), checkBadChambers_, clcts_d_token_, clcts_e_token_, compDigi_token_, compDigiProducer_, dataIsAnotherMC_, dataLctsIn_, debug, emulLctsIn_, event_tree, gangedME1a, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), lctProducerData_, lctProducerEmul_, lcts_mpc_d_token_, lcts_mpc_e_token_, lcts_tmb_d_token_, lcts_tmb_e_token_, mpclctProducerData_, perStub, plotME1A, plotME42, pretrigs_e_token_, printps, resultsFileNamesPrefix_, setRootStyle(), simHit_token_, simHitProducer_, stub_tree, stubs_comparison, wireDigi_token_, and wireDigiProducer_.

303  : eventsAnalyzed(0) {
305  // rootFileName = conf.getUntrackedParameter<string>("rootFileName","TPEHists.root");
306  // Create the root file for the histograms
307  // theFile = new TFile(rootFileName.c_str(), "RECREATE");
308  // theFile->cd();
309 
310  // Various input parameters.
311 
312  printps = conf.getParameter<bool>("printps");
313  dataLctsIn_ = conf.getParameter<bool>("dataLctsIn");
314  emulLctsIn_ = conf.getParameter<bool>("emulLctsIn");
315  edm::ParameterSet commonParams =
316  conf.getParameter<edm::ParameterSet>("commonParam");
317 
318  // Switch for a new (2007) version of the TMB firmware.
319  gangedME1a = commonParams.getParameter<bool>("gangedME1a");
320 
321  // is it (non-upgrade algorithm) run along with upgrade one?
322  plotME1A = true;
323  plotME42 = true;
324  lctProducerData_ = conf.getUntrackedParameter<string>("CSCLCTProducerData",
325  "cscunpacker");
326  mpclctProducerData_ = conf.getUntrackedParameter<string>("CSCMPCLCTProducerData",
327  "csctfDigis");
328  lctProducerEmul_ = conf.getUntrackedParameter<string>("CSCLCTProducerEmul",
329  "cscTriggerPrimitiveDigis");
330 
331  simHitProducer_ = conf.getParameter<edm::InputTag>("CSCSimHitProducer");
332  wireDigiProducer_ = conf.getParameter<edm::InputTag>("CSCWireDigiProducer");
333  compDigiProducer_ = conf.getParameter<edm::InputTag>("CSCComparatorDigiProducer");
334 
335  simHit_token_ = consumes<edm::PSimHitContainer>(simHitProducer_);
336  wireDigi_token_ = consumes<CSCWireDigiCollection>(wireDigiProducer_);
337  compDigi_token_ = consumes<CSCComparatorDigiCollection>(compDigiProducer_);
338 
339  alcts_d_token_ = consumes<CSCALCTDigiCollection>(edm::InputTag(lctProducerData_, "MuonCSCALCTDigi"));
340  clcts_d_token_ = consumes<CSCCLCTDigiCollection>(edm::InputTag(lctProducerData_, "MuonCSCCLCTDigi"));
341  lcts_tmb_d_token_ = consumes<CSCCorrelatedLCTDigiCollection>(edm::InputTag(lctProducerData_, "MuonCSCCorrelatedLCTDigi"));
342  lcts_mpc_d_token_ = consumes<CSCCorrelatedLCTDigiCollection>(edm::InputTag(mpclctProducerData_));
343 
344  alcts_e_token_ = consumes<CSCALCTDigiCollection>(edm::InputTag(lctProducerEmul_));
345  clcts_e_token_ = consumes<CSCCLCTDigiCollection>(edm::InputTag(lctProducerEmul_));
346  pretrigs_e_token_ = consumes<CSCCLCTPreTriggerDigiCollection>(edm::InputTag(lctProducerEmul_));
347  lcts_tmb_e_token_ = consumes<CSCCorrelatedLCTDigiCollection>(edm::InputTag(lctProducerEmul_));
348  lcts_mpc_e_token_ = consumes<CSCCorrelatedLCTDigiCollection>(edm::InputTag(lctProducerEmul_, "MPCSORTED"));
349 
350  consumesMany<edm::HepMCProduct>();
351  resultsFileNamesPrefix_ = conf.getUntrackedParameter<string>("resultsFileNamesPrefix","");
352  checkBadChambers_ = conf.getUntrackedParameter<bool>("checkBadChambers",true);
353  debug = conf.getUntrackedParameter<bool>("debug", false);
354  dataIsAnotherMC_ = conf.getUntrackedParameter<bool>("dataIsAnotherMC", false);
355 
356  //rootFileName = conf.getUntrackedParameter<string>("rootFileName");
357  // Create the root file.
358  // Not sure we really need it - comment out for now. -Slava.
359  //theFile = new TFile(rootFileName.c_str(), "RECREATE");
360  //theFile->cd();
361  stub_tree[0] = stubs_comparison[0].bookTree(stub_tree[0],"alcttree");
362  stub_tree[1] = stubs_comparison[1].bookTree(stub_tree[1],"clcttree");
363  stub_tree[2] = stubs_comparison[2].bookTree(stub_tree[2],"lcttree");
364  stub_tree[3] = stubs_comparison[3].bookTree(stub_tree[3],"mpclcttree");
365  // Per event TTree
366  event_tree[0] = perStub[0].bookTree(event_tree[0],"Ev_alcttree");
367  event_tree[1] = perStub[1].bookTree(event_tree[1],"Ev_emul_alcttree");
368  event_tree[2] = perStub[2].bookTree(event_tree[2],"Ev_clcttree");
369  event_tree[3] = perStub[3].bookTree(event_tree[3],"Ev_emul_clcttree");
370  event_tree[4] = perStub[4].bookTree(event_tree[4],"Ev_lcttree");
371  event_tree[5] = perStub[5].bookTree(event_tree[5],"Ev_emul_lcttree");
372  // My favourite ROOT settings.
373  setRootStyle();
374 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< CSCALCTDigiCollection > alcts_e_token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_tmb_e_token_
edm::EDGetTokenT< CSCWireDigiCollection > wireDigi_token_
edm::EDGetTokenT< CSCCLCTDigiCollection > clcts_e_token_
TTree * bookTree(TTree *t, const std::string &name="Stub_compare")
TTree * bookTree(TTree *t, const std::string &name="TreePerStub")
edm::EDGetTokenT< CSCALCTDigiCollection > alcts_d_token_
edm::EDGetTokenT< CSCComparatorDigiCollection > compDigi_token_
edm::EDGetTokenT< CSCCLCTDigiCollection > clcts_d_token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_mpc_e_token_
edm::EDGetTokenT< edm::PSimHitContainer > simHit_token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_mpc_d_token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_tmb_d_token_
edm::EDGetTokenT< CSCCLCTPreTriggerDigiCollection > pretrigs_e_token_
CSCTriggerPrimitivesReader::~CSCTriggerPrimitivesReader ( )
virtual

Destructor.

Definition at line 379 of file CSCTriggerPrimitivesReader.cc.

379  {
380  // histos->writeHists(theFile);
381  // theFile->Close();
382  //delete theFile;
383 }

Member Function Documentation

void CSCTriggerPrimitivesReader::analyze ( const edm::Event event,
const edm::EventSetup setup 
)

Does the job.

Definition at line 396 of file CSCTriggerPrimitivesReader.cc.

References alcts_d_token_, alcts_e_token_, badChambers_, checkBadChambers_, clcts_d_token_, clcts_e_token_, compare(), dataLctsIn_, emulLctsIn_, edm::EventID::event(), Event_, eventsAnalyzed, fillALCTHistos(), fillCLCTHistos(), fillLCTTMBHistos(), geom_, edm::EventSetup::get(), edm::Event::getByToken(), HotWires(), edm::EventBase::id(), edm::HandleBase::isValid(), lcts_mpc_d_token_, lcts_mpc_e_token_, lcts_tmb_d_token_, lcts_tmb_e_token_, LogTrace, MCStudies(), pretrigs_e_token_, edm::Handle< T >::product(), edm::ESHandle< T >::product(), edm::EventID::run(), and RUN_.

397  {
398  ++eventsAnalyzed;
399  //if (ev.id().event()%10 == 0)
400  LogTrace("CSCTriggerPrimitivesReader")
401  << "\n** CSCTriggerPrimitivesReader: processing run #"
402  << ev.id().run() << " event #" << ev.id().event()
403  << "; events so far: " << eventsAnalyzed << " **";
404  RUN_ = ev.id().run();
405  Event_ = ev.id().event();
406 
407  // Find the geometry for this event & cache it. Needed in LCTAnalyzer
408  // modules.
410  setup.get<MuonGeometryRecord>().get(cscGeom);
411  geom_ = &*cscGeom;
412 
413  // Find conditions data for bad chambers & cache it. Needed for efficiency
414  // calculations.
415  if (checkBadChambers_) {
417  setup.get<CSCBadChambersRcd>().get(pBad);
418  badChambers_ = pBad.product();
419  }
420 
421  // Get the collections of ALCTs, CLCTs, and correlated LCTs from event.
431 
432  // Data
433  if (dataLctsIn_) {
434  HotWires(ev);
435  // ev.getByLabel(lctProducerData_, alcts_data);
436  // ev.getByLabel(lctProducerData_, clcts_data);
437  // ev.getByLabel(lctProducerData_, lcts_tmb_data);
438  ev.getByToken(alcts_d_token_, alcts_data);
439  ev.getByToken(clcts_d_token_, clcts_data);
440  ev.getByToken(lcts_tmb_d_token_, lcts_tmb_data);
441  ev.getByToken(lcts_mpc_d_token_, lcts_mpc_data);
442 
443  if (!alcts_data.isValid()) {
444  edm::LogWarning("L1CSCTPEmulatorWrongInput")
445  << "+++ Warning: Collection of ALCTs with label MuonCSCALCTDigi"
446  << " requested, but not found in the event... Skipping the rest +++\n";
447  return;
448  }
449  if (!clcts_data.isValid()) {
450  edm::LogWarning("L1CSCTPEmulatorWrongInput")
451  << "+++ Warning: Collection of CLCTs with label MuonCSCCLCTDigi"
452  << " requested, but not found in the event... Skipping the rest +++\n";
453  return;
454  }
455  if (!lcts_tmb_data.isValid()) {
456  edm::LogWarning("L1CSCTPEmulatorWrongInput")
457  << "+++ Warning: Collection of correlated LCTs with label"
458  << " MuonCSCCorrelatedLCTDigi requested, but not found in the"
459  << " event... Skipping the rest +++\n";
460  return;
461  }
462  /*
463  if (!lcts_mpc_data.isValid()) {
464  edm::LogWarning("L1CSCTPEmulatorWrongInput")
465  << "+++ Warning: Collection of MPC correlated LCTs with label"
466  << " MuonCSCCorrelatedLCTDigi + MCPSorted requested, but not found in the"
467  << " event... Skipping the rest +++\n";
468  //return;
469  }*/
470  }
471 
472  // Emulator
473  if (emulLctsIn_) {
474  // ev.getByLabel(lctProducerEmul_, alcts_emul);
475  // ev.getByLabel(lctProducerEmul_, clcts_emul);
476  // ev.getByLabel(lctProducerEmul_, lcts_tmb_emul);
477  // ev.getByLabel(lctProducerEmul_, "MPCSORTED", lcts_mpc_emul);
478  ev.getByToken(alcts_e_token_, alcts_emul);
479  ev.getByToken(clcts_e_token_, clcts_emul);
480  ev.getByToken(pretrigs_e_token_, pretrigs_emul);
481  ev.getByToken(lcts_tmb_e_token_, lcts_tmb_emul);
482  ev.getByToken(lcts_mpc_e_token_, lcts_mpc_emul);
483 
484  if (!alcts_emul.isValid()) {
485  edm::LogWarning("L1CSCTPEmulatorWrongInput")
486  << "+++ Warning: Collection of emulated ALCTs"
487  << " requested, but not found in the event... Skipping the rest +++\n";
488  return;
489  }
490  if (!clcts_emul.isValid()) {
491  edm::LogWarning("L1CSCTPEmulatorWrongInput")
492  << "+++ Warning: Collection of emulated CLCTs"
493  << " requested, but not found in the event... Skipping the rest +++\n";
494  return;
495  }
496  if (!lcts_tmb_emul.isValid()) {
497  edm::LogWarning("L1CSCTPEmulatorWrongInput")
498  << "+++ Warning: Collection of emulated correlated LCTs"
499  << " requested, but not found in the event... Skipping the rest +++\n";
500  return;
501  }
502  /*
503  if (!lcts_mpc_emul.isValid()) {
504  edm::LogWarning("L1CSCTPEmulatorWrongInput")
505  << "+++ Warning: Collection of emulated correlated LCTs (MPCs)"
506  << " requested, but not found in the event... Skipping the rest +++\n";
507  //return;
508  }*/
509  }
510 
511  // Fill histograms with reconstructed or emulated quantities. If both are
512  // present, plot LCTs in data.
513  if (dataLctsIn_) {
514  fillALCTHistos(alcts_data.product());
515  fillCLCTHistos(clcts_data.product());
516  fillLCTTMBHistos(lcts_tmb_data.product());
517  }
518  else if (emulLctsIn_) {
519  fillALCTHistos(alcts_emul.product());
520  fillCLCTHistos(clcts_emul.product());
521  fillLCTTMBHistos(lcts_tmb_emul.product());
522  //fillLCTMPCHistos(lcts_mpc_emul.product());
523  }
524 
525  // Compare LCTs in the data with the ones produced by the emulator.
526  if (dataLctsIn_ && emulLctsIn_) {
527  compare(alcts_data.product(), alcts_emul.product(),
528  clcts_data.product(), clcts_emul.product(),
529  pretrigs_emul.product(), lcts_tmb_data.product(), lcts_tmb_emul.product()
530  );
531  }
532  // Fill MC-based resolution/efficiency histograms, if needed.
533  if (emulLctsIn_) {
534  MCStudies(ev, alcts_emul.product(), clcts_emul.product());
535  }
536 } // analyze
void fillLCTTMBHistos(const CSCCorrelatedLCTDigiCollection *lcts)
edm::EDGetTokenT< CSCALCTDigiCollection > alcts_e_token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_tmb_e_token_
void compare(const CSCALCTDigiCollection *alcts_data, const CSCALCTDigiCollection *alcts_emul, const CSCCLCTDigiCollection *clcts_data, const CSCCLCTDigiCollection *clcts_emul, const CSCCLCTPreTriggerDigiCollection *pretrigs_emul, const CSCCorrelatedLCTDigiCollection *lcts_data, const CSCCorrelatedLCTDigiCollection *lcts_emul)
bool ev
edm::EDGetTokenT< CSCCLCTDigiCollection > clcts_e_token_
void MCStudies(const edm::Event &ev, const CSCALCTDigiCollection *alcts, const CSCCLCTDigiCollection *clcts)
edm::EDGetTokenT< CSCALCTDigiCollection > alcts_d_token_
bool isValid() const
Definition: HandleBase.h:74
#define LogTrace(id)
T const * product() const
Definition: Handle.h:74
T get() const
Definition: EventSetup.h:71
edm::EDGetTokenT< CSCCLCTDigiCollection > clcts_d_token_
void fillCLCTHistos(const CSCCLCTDigiCollection *clcts)
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_mpc_e_token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_mpc_d_token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_tmb_d_token_
void fillALCTHistos(const CSCALCTDigiCollection *alcts)
T const * product() const
Definition: ESHandle.h:86
void HotWires(const edm::Event &iEvent)
edm::EDGetTokenT< CSCCLCTPreTriggerDigiCollection > pretrigs_e_token_
void CSCTriggerPrimitivesReader::bookALCTHistos ( )
private

Definition at line 675 of file CSCTriggerPrimitivesReader.cc.

References bookedALCTHistos, gather_cfg::cout, csc_type_minus, csc_type_plus, CSC_TYPES, hAlctAccel, hAlctBXN, hAlctCollis, hAlctCsc, hAlctKeyGroup, hAlctKeyGroupME11, hAlctPerChamber, hAlctPerCSC, hAlctPerEvent, hAlctQuality, hAlctValid, mps_fire::i, TFileService::make(), MAX_ENDCAPS, NCHAMBERS, and alignCSCRings::s.

Referenced by fillALCTHistos().

675  {
676  string s;
677 
679  hAlctPerEvent = fs->make<TH1F>("ALCTs_per_event", "ALCTs per event", 31, -0.5, 30.5);
680  hAlctPerChamber= fs->make<TH1F>("ALCTs_per_chamber", "ALCTs per chamber", 4, -0.5, 3.5);
681  hAlctPerCSC = fs->make<TH1F>("ALCTs_per_CSCtype", "ALCTs per CSC type", 10, -0.5, 9.5);
682  for (int i = 0; i < MAX_ENDCAPS; i++) { // endcaps
683  for (int j = 0; j < CSC_TYPES; j++) { // station/ring
684  float csc_max = NCHAMBERS[j] + 0.5;
685  char asdf[256];
686  sprintf(asdf,"ALCTs_%i",i*CSC_TYPES+j);
687  if (i == 0) s = "ALCTs, " + csc_type_plus[j];
688  else s = "ALCTs, " + csc_type_minus[j];
689  hAlctCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
690  }
691  }
692 
693  hAlctValid = fs->make<TH1F>("ALCT_validity", "ALCT validity", 3, -0.5, 2.5);
694  hAlctQuality = fs->make<TH1F>("ALCT_quality", "ALCT quality", 5, -0.5, 4.5);
695  hAlctAccel = fs->make<TH1F>("ALCT_accel_flag", "ALCT accel. flag", 3, -0.5, 2.5);
696  hAlctCollis = fs->make<TH1F>("ALCT_collision_flag", "ALCT collision. flag", 3, -0.5, 2.5);
697  hAlctKeyGroup = fs->make<TH1F>("ALCT_key_wiregroup", "ALCT key wiregroup", 120, -0.5, 119.5);
698  hAlctBXN = fs->make<TH1F>("ALCT_bx", "ALCT bx", 20, -0.5, 19.5);
699 
700  hAlctKeyGroupME11 = fs->make<TH1F>("hAlctKeyGroupME11", "ALCT key wiregroup ME1/1", 50, -0.5, 49.5);
701 
702  bookedALCTHistos = true;
703  std::cout <<" bookedALCTHistos " << std::endl;
704 }
static const int NCHAMBERS[CSC_TYPES]
static const std::string csc_type_minus[CSC_TYPES]
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
TH1F * hAlctCsc[MAX_ENDCAPS][CSC_TYPES]
static const std::string csc_type_plus[CSC_TYPES]
void CSCTriggerPrimitivesReader::bookCLCTHistos ( )
private

Definition at line 706 of file CSCTriggerPrimitivesReader.cc.

References bookedCLCTHistos, gather_cfg::cout, csc_type, csc_type_minus, csc_type_plus, CSC_TYPES, hClctBendCsc, hClctBXN, hClctCFEB, hClctCsc, hClctKeyStrip, hClctKeyStripCsc, hClctKeyStripME11, hClctPattern, hClctPerChamber, hClctPerCSC, hClctPerEvent, hClctQuality, hClctSign, hClctStripType, hClctValid, mps_fire::i, TFileService::make(), MAX_ENDCAPS, MAX_HS, NCHAMBERS, alignCSCRings::s, and indexGen::s2.

Referenced by fillCLCTHistos().

706  {
707  string s;
708 
710  hClctPerEvent = fs->make<TH1F>("CLCTs_per_event", "CLCTs per event", 31, -0.5, 30.5);
711  hClctPerChamber= fs->make<TH1F>("CLCTs_per_chamber", "CLCTs per chamber", 3, -0.5, 2.5);
712  hClctPerCSC = fs->make<TH1F>("CLCTs_per_CSCtype", "CLCTs per CSC type", 10, -0.5, 9.5);
713  for (int i = 0; i < MAX_ENDCAPS; i++) { // endcaps
714  for (int j = 0; j < CSC_TYPES; j++) { // station/ring
715  char asdf[256];
716  sprintf(asdf,"CLCTs_%i",i*CSC_TYPES+j);
717  float csc_max = NCHAMBERS[j] + 0.5;
718  if (i == 0) s = "CLCTs, " + csc_type_plus[j];
719  else s = "CLCTs, " + csc_type_minus[j];
720  hClctCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
721  }
722  }
723 
724  hClctValid = fs->make<TH1F>("CLCT_validity", "CLCT validity", 3, -0.5, 2.5);
725  hClctQuality = fs->make<TH1F>("CLCT_layers_hit", "CLCT layers hit", 9, -0.5, 8.5);
726  hClctStripType = fs->make<TH1F>("CLCT_strip_type", "CLCT strip type", 3, -0.5, 2.5);
727  hClctSign = fs->make<TH1F>("CLCT_sing_(L/R)", "CLCT sign (L/R)", 3, -0.5, 2.5);
728  hClctCFEB = fs->make<TH1F>("CLCT_cfeb_#", "CLCT cfeb #", 6, -0.5, 5.5);
729  hClctBXN = fs->make<TH1F>("CLCT_bx", "CLCT bx", 20, -0.5, 19.5);
730 
731  hClctKeyStrip[0] = fs->make<TH1F>("CLCT_keystrip_distrips","CLCT keystrip, distrips", 40, -0.5, 39.5);
732  //hClctKeyStrip[0] = fs->make<TH1F>("","CLCT keystrip, distrips", 160, -0.5, 159.5);
733  hClctKeyStrip[1] = fs->make<TH1F>("CLCT_keystrip_halfstrips","CLCT keystrip, halfstrips",160, -0.5, 159.5);
734  hClctPattern[0] = fs->make<TH1F>("CLCT_pattern_distrips","CLCT pattern, distrips", 13, -0.5, 12.5);
735  hClctPattern[1] = fs->make<TH1F>("CLCT_pattern_halfstrips","CLCT pattern, halfstrips", 13, -0.5, 12.5);
736 
737  for (int i = 0; i < CSC_TYPES; i++) {
738  char asdf[256];
739  string s1 = "CLCT bend, " + csc_type[i];
740  sprintf(asdf,"CLCT_bend0_%i",i+1);
741  hClctBendCsc[i][0] = fs->make<TH1F>(asdf, s1.c_str(), 5, -0.5, 4.5);
742  sprintf(asdf,"CLCT_bend1_%i",i+1);
743  hClctBendCsc[i][1] = fs->make<TH1F>(asdf, s1.c_str(), 5, -0.5, 4.5);
744 
745  sprintf(asdf,"CLCT_keystrip_%i",i+1);
746  string s2 = "CLCT keystrip, " + csc_type[i];
747  int max_ds = MAX_HS[i]/4;
748  hClctKeyStripCsc[i] = fs->make<TH1F>(asdf, s2.c_str(), max_ds, 0., max_ds);
749  }
750 
751  hClctKeyStripME11 = fs->make<TH1F>("hClctKeyStripME11","CLCT keystrip, halfstrips ME1/1",161, -0.5, 160.5);
752 
753  bookedCLCTHistos = true;
754  std::cout <<" bookedCLCTHistos " << std::endl;
755 }
static const int NCHAMBERS[CSC_TYPES]
static const std::string csc_type_minus[CSC_TYPES]
static const int MAX_HS[CSC_TYPES]
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
static const std::string csc_type[CSC_TYPES]
TH1F * hClctCsc[MAX_ENDCAPS][CSC_TYPES]
static const std::string csc_type_plus[CSC_TYPES]
void CSCTriggerPrimitivesReader::bookCompHistos ( )
private

Definition at line 887 of file CSCTriggerPrimitivesReader.cc.

References bookedCompHistos, gather_cfg::cout, csc_type_minus, csc_type_plus, CSC_TYPES, debug, hAlctCompFound, hAlctCompFound2, hAlctCompFound2i, hAlctCompFound2x, hAlctCompFoundCsc, hAlctCompMatch, hAlctCompMatch2, hAlctCompMatch2i, hAlctCompMatch2x, hAlctCompMatchCsc, hAlctCompSameN, hAlctCompSameN2, hAlctCompSameN2i, hAlctCompSameN2x, hAlctCompSameNCsc, hAlctCompTotal, hAlctCompTotal2, hAlctCompTotal2i, hAlctCompTotal2x, hAlctCompTotalCsc, hClctCompFound, hClctCompFound2, hClctCompFound2i, hClctCompFound2x, hClctCompFoundCsc, hClctCompMatch, hClctCompMatch2, hClctCompMatch2i, hClctCompMatch2x, hClctCompMatchCsc, hClctCompSameN, hClctCompSameN2, hClctCompSameN2i, hClctCompSameN2x, hClctCompSameNCsc, hClctCompTotal, hClctCompTotal2, hClctCompTotal2i, hClctCompTotal2x, hClctCompTotalCsc, hLCTCompFound, hLCTCompFound2, hLCTCompFound2i, hLCTCompFound2x, hLctCompFoundCsc, hLCTCompMatch, hLCTCompMatch2, hLCTCompMatch2i, hLCTCompMatch2x, hLctCompMatchCsc, hLCTCompSameN, hLCTCompSameN2, hLCTCompSameN2i, hLCTCompSameN2x, hLctCompSameNCsc, hLCTCompTotal, hLCTCompTotal2, hLCTCompTotal2i, hLCTCompTotal2x, hLctCompTotalCsc, mps_fire::i, LogTrace, TFileService::make(), MAX_ENDCAPS, NCHAMBERS, and alignCSCRings::s.

Referenced by compare().

887  {
888  string s;
889 
890 
891 
893  // hAlctCompMatch;
894 
895  hAlctCompFound = fs->make<TH1F>("h_ALCT_found","h_ALCT_found",600,0.5,600.5);
896  hAlctCompFound2 = fs->make<TH2F>("h_ALCT_found2","h_ALCT_found2",19,-9.5,9.5,36,0.5,36.5);
897  hAlctCompFound2x = fs->make<TH2F>("h_ALCT_found2x","h_ALCT_found2x",19,-9.5,9.5,18,0.5,36.5);
898 
899 
900  hAlctCompSameN = fs->make<TH1F>("h_ALCT_SameN","h_ALCT_SameN",600,0.5,600.5);
901  hAlctCompSameN2 = fs->make<TH2F>("h_ALCT_SameN2","h_ALCT_SameN2",19,-9.5,9.5,36,0.5,36.5);
902  hAlctCompSameN2x = fs->make<TH2F>("h_ALCT_SameN2x","h_ALCT_SameN2x",19,-9.5,9.5,18,0.5,36.5);
903 
904 
905  hAlctCompMatch = fs->make<TH1F>("h_ALCT_match","h_ALCT_match",600,0.5,600.5);
906  hAlctCompMatch2 = fs->make<TH2F>("h_ALCT_match2","h_ALCT_match2",19,-9.5,9.5,36,0.5,36.5);
907  hAlctCompMatch2x = fs->make<TH2F>("h_ALCT_match2x","h_ALCT_match2x",19,-9.5,9.5,18,0.5,36.5);
908 
909  hAlctCompTotal = fs->make<TH1F>("h_ALCT_total","h_ALCT_total",600,0.5,600.5);
910  hAlctCompTotal2 = fs->make<TH2F>("h_ALCT_total2","h_ALCT_total2",19,-9.5,9.5,36,0.5,36.5);
911  hAlctCompTotal2x = fs->make<TH2F>("h_ALCT_total2x","h_ALCT_total2x",19,-9.5,9.5,18,0.5,36.5);
912 
913  hClctCompFound = fs->make<TH1F>("h_CLCT_found","h_CLCT_found",600,0.5,600.5);
914  hClctCompFound2 = fs->make<TH2F>("h_CLCT_found2","h_CLCT_found2",19,-9.5,9.5,36,0.5,36.5);
915  hClctCompFound2x = fs->make<TH2F>("h_CLCT_found2x","h_CLCT_found2x",19,-9.5,9.5,18,0.5,36.5);
916 
917  hClctCompSameN = fs->make<TH1F>("h_CLCT_SameN","h_CLCT_SameN",600,0.5,600.5);
918  hClctCompSameN2 = fs->make<TH2F>("h_CLCT_SameN2","h_CLCT_SameN2",19,-9.5,9.5,36,0.5,36.5);
919  hClctCompSameN2x = fs->make<TH2F>("h_CLCT_SameN2x","h_CLCT_SameN2x",19,-9.5,9.5,18,0.5,36.5);
920 
921  hClctCompMatch = fs->make<TH1F>("h_CLCT_match","h_CLCT_match",600,0.5,600.5);
922  hClctCompMatch2 = fs->make<TH2F>("h_CLCT_match2","h_CLCT_match2",19,-9.5,9.5,36,0.5,36.5);
923  hClctCompMatch2x = fs->make<TH2F>("h_CLCT_match2x","h_CLCT_match2x",19,-9.5,9.5,18,0.5,36.5);
924 
925  hClctCompTotal = fs->make<TH1F>("h_CLCT_total","h_CLCT_total",600,0.5,600.5);
926  hClctCompTotal2 = fs->make<TH2F>("h_CLCT_total2","h_CLCT_total2",19,-9.5,9.5,36,0.5,36.5);
927  hClctCompTotal2x = fs->make<TH2F>("h_CLCT_total2x","h_CLCT_total2x",19,-9.5,9.5,18,0.5,36.5);
928 
929  hLCTCompFound = fs->make<TH1F>("h_LCT_found","h_LCT_found",600,0.5,600.5);
930  hLCTCompFound2 = fs->make<TH2F>("h_LCT_found2","h_LCT_found2",19,-9.5,9.5,36,0.5,36.5);
931  hLCTCompFound2x = fs->make<TH2F>("h_LCT_found2x","h_LCT_found2x",19,-9.5,9.5,18,0.5,36.5);
932 
933  hLCTCompSameN = fs->make<TH1F>("h_LCT_SameN","h_LCT_SameN",600,0.5,600.5);
934  hLCTCompSameN2 = fs->make<TH2F>("h_LCT_SameN2","h_LCT_SameN2",19,-9.5,9.5,36,0.5,36.5);
935  hLCTCompSameN2x = fs->make<TH2F>("h_LCT_SameN2x","h_LCT_SameN2x",19,-9.5,9.5,18,0.5,36.5);
936 
937  hLCTCompMatch = fs->make<TH1F>("h_LCT_match","h_LCT_match",600,0.5,600.5);
938  hLCTCompMatch2 = fs->make<TH2F>("h_LCT_match2","h_LCT_match2",19,-9.5,9.5,36,0.5,36.5);
939  hLCTCompMatch2x = fs->make<TH2F>("h_LCT_match2x","h_LCT_match2x",19,-9.5,9.5,18,0.5,36.5);
940 
941  hLCTCompTotal = fs->make<TH1F>("h_LCT_total","h_LCT_total",600,0.5,600.5);
942  hLCTCompTotal2 = fs->make<TH2F>("h_LCT_total2","h_LCT_total2",19,-9.5,9.5,36,0.5,36.5);
943  hLCTCompTotal2x = fs->make<TH2F>("h_LCT_total2x","h_LCT_total2x",19,-9.5,9.5,18,0.5,36.5);
944 
945  //Chad's improved historgrams
946  hAlctCompFound2i = fs->make<TH2F>("h_ALCT_found2i","h_ALCT_found2i",18,0,18,36,0.5,36.5);
947  hAlctCompSameN2i = fs->make<TH2F>("h_ALCT_SameN2i","h_ALCT_SameN2i",18,0,18,36,0.5,36.5);
948  hAlctCompMatch2i = fs->make<TH2F>("h_ALCT_match2i","h_ALCT_match2i",18,0,18,36,0.5,36.5);
949  hAlctCompTotal2i = fs->make<TH2F>("h_ALCT_total2i","h_ALCT_total2i",18,0,18,36,0.5,36.5);
950  hClctCompFound2i = fs->make<TH2F>("h_CLCT_found2i","h_CLCT_found2i",18,0,18,36,0.5,36.5);
951  hClctCompSameN2i = fs->make<TH2F>("h_CLCT_SameN2i","h_CLCT_SameN2i",18,0,18,36,0.5,36.5);
952  hClctCompMatch2i = fs->make<TH2F>("h_CLCT_match2i","h_CLCT_match2i",18,0,18,36,0.5,36.5);
953  hClctCompTotal2i = fs->make<TH2F>("h_CLCT_total2i","h_CLCT_total2i",18,0,18,36,0.5,36.5);
954  hLCTCompFound2i = fs->make<TH2F>("h_LCT_found2i","h_LCT_found2i",18,0,18,36,0.5,36.5);
955  hLCTCompSameN2i = fs->make<TH2F>("h_LCT_SameN2i","h_LCT_SameN2i",18,0,18,36,0.5,36.5);
956  hLCTCompMatch2i = fs->make<TH2F>("h_LCT_match2i","h_LCT_match2i",18,0,18,36,0.5,36.5);
957  hLCTCompTotal2i = fs->make<TH2F>("h_LCT_total2i","h_LCT_total2i",18,0,18,36,0.5,36.5);
958 
959  // hAlctCompFound = fs->make<TH1F>("h_ALCT_found","h_ALCT_found",600,0.5,600.5);
960 
961  // ALCTs.
962  for (int i = 0; i < MAX_ENDCAPS; i++) { // endcaps
963  for (int j = 0; j < CSC_TYPES; j++) { // station/ring
964  char asdf[256];
965 
966  float csc_max = NCHAMBERS[j] + 0.5;
967  if (i == 0) s = "Comp_ALCTs, " + csc_type_plus[j];
968  else s = "Comp_ALCTs, " + csc_type_minus[j];
969  sprintf(asdf,"Comp_ALCTsFound_%i",i*CSC_TYPES+j);
970  hAlctCompFoundCsc[i][j] =
971  fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
972  sprintf(asdf,"Comp_ALCTsSame_%i",i*CSC_TYPES+j);
973  hAlctCompSameNCsc[i][j] =
974  fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
975  sprintf(asdf,"Comp_ALCTsTotal_%i",i*CSC_TYPES+j);
976  hAlctCompTotalCsc[i][j] =
977  fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
978  sprintf(asdf,"Comp_ALCTsMatch_%i",i*CSC_TYPES+j);
979  hAlctCompMatchCsc[i][j] =
980  fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
981  hAlctCompFoundCsc[i][j]->Sumw2();
982  hAlctCompSameNCsc[i][j]->Sumw2();
983  hAlctCompTotalCsc[i][j]->Sumw2();
984  hAlctCompMatchCsc[i][j]->Sumw2();
985  }
986  }
987 
988  // CLCTs.
989  for (int i = 0; i < MAX_ENDCAPS; i++) { // endcaps
990  for (int j = 0; j < CSC_TYPES; j++) { // station/ring
991  float csc_max = NCHAMBERS[j] + 0.5;
992  char asdf[256];
993  if (i == 0) s = "Comp_CLCTs, " + csc_type_plus[j];
994  else s = "Comp_CLCTs, " + csc_type_minus[j];
995  sprintf(asdf,"Comp_CLCTsFound_%i",i*CSC_TYPES+j);
996  hClctCompFoundCsc[i][j] =
997  fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
998  sprintf(asdf,"Comp_CLCTsSame_%i",i*CSC_TYPES+j);
999  hClctCompSameNCsc[i][j] =
1000  fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
1001  sprintf(asdf,"Comp_CLCTsTotal_%i",i*CSC_TYPES+j);
1002  hClctCompTotalCsc[i][j] =
1003  fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
1004  sprintf(asdf,"Comp_CLCTsMatch_%i",i*CSC_TYPES+j);
1005  hClctCompMatchCsc[i][j] =
1006  fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
1007  hClctCompFoundCsc[i][j]->Sumw2();
1008  hClctCompSameNCsc[i][j]->Sumw2();
1009  hClctCompTotalCsc[i][j]->Sumw2();
1010  hClctCompMatchCsc[i][j]->Sumw2();
1011  }
1012  }
1013 
1014  // Correlated LCTs.
1015  for (int i = 0; i < MAX_ENDCAPS; i++) { // endcaps
1016  for (int j = 0; j < CSC_TYPES; j++) { // station/ring
1017  float csc_max = NCHAMBERS[j] + 0.5;
1018  char asdf[256];
1019  if (i == 0) s = "LCTs, " + csc_type_plus[j];
1020  else s = "LCTs, " + csc_type_minus[j];
1021  sprintf(asdf,"LCTs_CompFound_%i",i*CSC_TYPES+j);
1022  hLctCompFoundCsc[i][j] =
1023  fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
1024  sprintf(asdf,"LCTs_CompSame_%i",i*CSC_TYPES+j);
1025  hLctCompSameNCsc[i][j] =
1026  fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
1027  sprintf(asdf,"LCTs_CompTotal_%i",i*CSC_TYPES+j);
1028  hLctCompTotalCsc[i][j] =
1029  fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
1030  sprintf(asdf,"LCTs_CompMatch_%i",i*CSC_TYPES+j);
1031  hLctCompMatchCsc[i][j] =
1032  fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
1033  hLctCompFoundCsc[i][j]->Sumw2();
1034  hLctCompSameNCsc[i][j]->Sumw2();
1035  hLctCompTotalCsc[i][j]->Sumw2();
1036  hLctCompMatchCsc[i][j]->Sumw2();
1037  }
1038  }
1039 
1040  bookedCompHistos = true;
1041  if (debug) LogTrace("CSCTriggerPrimitivesReader")
1042  <<"bookedCompHistos ";
1043  std::cout <<"bookCompHistos "<< std::endl;
1044 }
TH1F * hClctCompTotalCsc[MAX_ENDCAPS][CSC_TYPES]
static const int NCHAMBERS[CSC_TYPES]
TH1F * hLctCompFoundCsc[MAX_ENDCAPS][CSC_TYPES]
TH1F * hClctCompFoundCsc[MAX_ENDCAPS][CSC_TYPES]
TH1F * hAlctCompSameNCsc[MAX_ENDCAPS][CSC_TYPES]
static const std::string csc_type_minus[CSC_TYPES]
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
TH1F * hAlctCompTotalCsc[MAX_ENDCAPS][CSC_TYPES]
TH1F * hClctCompSameNCsc[MAX_ENDCAPS][CSC_TYPES]
TH1F * hAlctCompFoundCsc[MAX_ENDCAPS][CSC_TYPES]
TH1F * hLctCompMatchCsc[MAX_ENDCAPS][CSC_TYPES]
TH1F * hLctCompSameNCsc[MAX_ENDCAPS][CSC_TYPES]
#define LogTrace(id)
TH1F * hAlctCompMatchCsc[MAX_ENDCAPS][CSC_TYPES]
TH1F * hClctCompMatchCsc[MAX_ENDCAPS][CSC_TYPES]
TH1F * hLctCompTotalCsc[MAX_ENDCAPS][CSC_TYPES]
static const std::string csc_type_plus[CSC_TYPES]
void CSCTriggerPrimitivesReader::bookEfficHistos ( )
private

Definition at line 1130 of file CSCTriggerPrimitivesReader.cc.

References bookedEfficHistos, gather_cfg::cout, csc_type, CSC_TYPES, debug, hEfficALCTEta, hEfficALCTEtaCsc, hEfficCLCTEta, hEfficCLCTEtaCsc, hEfficHitsEta, hEfficHitsEtaCsc, mps_fire::i, LogTrace, TFileService::make(), MAX_STATIONS, and genVertex_cff::t0.

Referenced by calcEfficiency().

1130  {
1132 
1133  // Efficiencies per station.
1134  char histname[60];
1135  for (int i = 0; i < MAX_STATIONS; i++) {
1136  sprintf(histname, "SimHits vs eta, station %d", i+1);
1137  hEfficHitsEta[i] = fs->make<TH1F>("", histname, 66, 0.875, 2.525);
1138 
1139  sprintf(histname, "ALCTs vs eta, station %d", i+1);
1140  hEfficALCTEta[i] = fs->make<TH1F>("", histname, 66, 0.875, 2.525);
1141 
1142  sprintf(histname, "CLCTs vs eta, station %d", i+1);
1143  hEfficCLCTEta[i] = fs->make<TH1F>("", histname, 66, 0.875, 2.525);
1144  }
1145 
1146  // Efficiencies per chamber type.
1147  for (int i = 0; i < CSC_TYPES; i++) {
1148  string t0 = "SimHits vs eta, " + csc_type[i];
1149  hEfficHitsEtaCsc[i] = fs->make<TH1F>("", t0.c_str(), 66, 0.875, 2.525);
1150  string t1 = "ALCTs vs eta, " + csc_type[i];
1151  hEfficALCTEtaCsc[i] = fs->make<TH1F>("", t1.c_str(), 66, 0.875, 2.525);
1152  string t2 = "CLCTs vs eta, " + csc_type[i];
1153  hEfficCLCTEtaCsc[i] = fs->make<TH1F>("", t1.c_str(), 66, 0.875, 2.525);
1154  }
1155 
1156  bookedEfficHistos = true;
1157  if (debug) LogTrace("CSCTriggerPrimitivesReader")
1158  <<"bookedEfficHistos ";
1159  std::cout <<" bookedEfficHistos " << std::endl;
1160 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
static const std::string csc_type[CSC_TYPES]
#define LogTrace(id)
void CSCTriggerPrimitivesReader::bookHotWireHistos ( )
private

Definition at line 668 of file CSCTriggerPrimitivesReader.cc.

References bookedHotWireHistos, hHotCham1, hHotWire1, and TFileService::make().

Referenced by HotWires().

668  {
670  hHotWire1 = fs->make<TH1F>("hHotWire1", "hHotWire1",570*6*112,0,570*6*112);
671  hHotCham1 = fs->make<TH1F>("hHotCham1", "hHotCham1",570,0,570);
672  bookedHotWireHistos = true;
673 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
void CSCTriggerPrimitivesReader::bookLCTMPCHistos ( )
private

Definition at line 851 of file CSCTriggerPrimitivesReader.cc.

References bookedLCTMPCHistos, gather_cfg::cout, debug, hCorrLctMPCPerCSC, hLctMPCBend, hLctMPCBXN, hLctMPCChamber, hLctMPCEndcap, hLctMPCKeyGroup, hLctMPCKeyGroupME11, hLctMPCKeyStrip, hLctMPCKeyStripME11, hLctMPCPattern, hLctMPCPerCSC, hLctMPCPerEvent, hLctMPCQuality, hLctMPCRing, hLctMPCSector, hLctMPCStation, hLctMPCStripType, hLctMPCValid, LogTrace, TFileService::make(), and MAX_STATIONS.

Referenced by fillLCTMPCHistos().

851  {
853  hLctMPCPerEvent = fs->make<TH1F>("MPC_per_event", "LCTs per event", 31, -0.5, 30.5);
854  hLctMPCPerCSC = fs->make<TH1F>("MPC_per_CSCtype", "LCTs per CSC type", 10, -0.5, 9.5);
855  hCorrLctMPCPerCSC= fs->make<TH1F>("CorrMPC_per_CSCtype", "Corr. LCTs per CSC type", 10, -0.5,9.5);
856  hLctMPCEndcap = fs->make<TH1F>("MPC_Endcap", "Endcap", 4, -0.5, 3.5);
857  hLctMPCStation = fs->make<TH1F>("MPC_Station", "Station", 6, -0.5, 5.5);
858  hLctMPCSector = fs->make<TH1F>("MPC_Sector", "Sector", 8, -0.5, 7.5);
859  hLctMPCRing = fs->make<TH1F>("MPC_Ring", "Ring", 5, -0.5, 4.5);
860 
861  hLctMPCValid = fs->make<TH1F>("MPC_validity", "LCT validity", 3, -0.5, 2.5);
862  hLctMPCQuality = fs->make<TH1F>("MPC_quality", "LCT quality", 17, -0.5, 16.5);
863  hLctMPCKeyGroup = fs->make<TH1F>("MPC_key_wiregroup", "LCT key wiregroup", 120, -0.5, 119.5);
864  hLctMPCKeyStrip = fs->make<TH1F>("MPC_key_strip", "LCT key strip", 160, -0.5, 159.5);
865  hLctMPCStripType = fs->make<TH1F>("MPC_strip_type", "LCT strip type", 3, -0.5, 2.5);
866  hLctMPCPattern = fs->make<TH1F>("MPC_pattern", "LCT pattern", 13, -0.5, 12.5);
867  hLctMPCBend = fs->make<TH1F>("MPC_bend", "LCT L/R bend", 3, -0.5, 2.5);
868  hLctMPCBXN = fs->make<TH1F>("MPC_bx", "LCT bx", 20, -0.5, 19.5);
869 
870  // LCT quantities per station
871  char histname[60];
872  for (int istat = 0; istat < MAX_STATIONS; istat++) {
873  sprintf(histname, "MPC_CSCId, station %d", istat+1);
874  hLctMPCChamber[istat] = fs->make<TH1F>("", histname, 10, -0.5, 9.5);
875  }
876 
877  hLctMPCKeyGroupME11 = fs->make<TH1F>("hLctMPCKeyGroupME11", "MPC LCT key wiregroup ME1/1", 50, -0.5, 49.5);
878  hLctMPCKeyStripME11 = fs->make<TH1F>("hLctMPCKeyStripME11", "MPC LCT key strip ME1/1", 161, -0.5, 160.5);
879 
880  bookedLCTMPCHistos = true;
881  if (debug) LogTrace("CSCTriggerPrimitivesReader")
882  <<"bookedLCTMPCHistos ";
883  std::cout <<" bookedLCTMPCHistos " << std::endl;
884 
885 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
#define LogTrace(id)
void CSCTriggerPrimitivesReader::bookLCTTMBHistos ( )
private

Definition at line 757 of file CSCTriggerPrimitivesReader.cc.

References bookedLCTTMBHistos, gather_cfg::cout, csc_type_minus, csc_type_plus, CSC_TYPES, hCorrLctTMBPerCSC, hLctTMBBend, hLctTMBBXN, hLctTMBChamber, hLctTMBCsc, hLctTMBEndcap, hLctTMBKeyGroup, hLctTMBKeyGroupME11, hLctTMBKeyStrip, hLctTMBKeyStripME11, hLctTMBPattern, hLctTMBPerChamber, hLctTMBPerCSC, hLctTMBPerEvent, hLctTMBQuality, hLctTMBRing, hLctTMBSector, hLctTMBStation, hLctTMBStripType, hLctTMBValid, mps_fire::i, TFileService::make(), MAX_ENDCAPS, MAX_STATIONS, NCHAMBERS, and alignCSCRings::s.

Referenced by fillLCTTMBHistos().

757  {
758  string s;
759 
761  hLctTMBPerEvent = fs->make<TH1F>("LCTs_per_event", "LCTs per event", 31, -0.5, 30.5);
762  hLctTMBPerChamber= fs->make<TH1F>("LCTs_per_chamber", "LCTs per chamber", 3, -0.5, 2.5);
763  hLctTMBPerCSC = fs->make<TH1F>("LCTs_per_CSCtype", "LCTs per CSC type", 10, -0.5, 9.5);
764  hCorrLctTMBPerCSC= fs->make<TH1F>("CorrLCTs_per_CSCtype", "Corr. LCTs per CSC type", 10, -0.5, 9.5);
765  hLctTMBEndcap = fs->make<TH1F>("LCTS_endcap", "Endcap", 4, -0.5, 3.5);
766  hLctTMBStation = fs->make<TH1F>("LCTS_station", "Station", 6, -0.5, 5.5);
767  hLctTMBSector = fs->make<TH1F>("LCTS_sector", "Sector", 8, -0.5, 7.5);
768  hLctTMBRing = fs->make<TH1F>("LCTS_ring", "Ring", 5, -0.5, 4.5);
769  for (int i = 0; i < MAX_ENDCAPS; i++) { // endcaps
770  for (int j = 0; j < CSC_TYPES; j++) { // station/ring
771  char asdf[256];
772  float csc_max = NCHAMBERS[j] + 0.5;
773  if (i == 0) s = "LCTs, " + csc_type_plus[j];
774  else s = "LCTs, " + csc_type_minus[j];
775  sprintf(asdf,"LCTs_%i",i*CSC_TYPES+j);
776  hLctTMBCsc[i][j] = fs->make<TH1F>(s.c_str(), s.c_str(), NCHAMBERS[j], 0.5, csc_max);
777  }
778  }
779 
780  hLctTMBValid = fs->make<TH1F>("LCT_validity", "LCT validity", 3, -0.5, 2.5);
781  hLctTMBQuality = fs->make<TH1F>("LCT_quality", "LCT quality", 17, -0.5, 16.5);
782  hLctTMBKeyGroup = fs->make<TH1F>("LCT_key_wiregroup", "LCT key wiregroup", 120, -0.5, 119.5);
783  hLctTMBKeyStrip = fs->make<TH1F>("LCT_key_strip", "LCT key strip", 160, -0.5, 159.5);
784  hLctTMBStripType = fs->make<TH1F>("LCT_strip_type", "LCT strip type", 3, -0.5, 2.5);
785  hLctTMBPattern = fs->make<TH1F>("LCT_pattern", "LCT pattern", 13, -0.5, 12.5);
786  hLctTMBBend = fs->make<TH1F>("LCT_bend", "LCT L/R bend", 3, -0.5, 2.5);
787  hLctTMBBXN = fs->make<TH1F>("LCT_bx", "LCT bx", 20, -0.5, 19.5);
788 
789  // LCT quantities per station
790  char histname[60];
791  for (int istat = 0; istat < MAX_STATIONS; istat++) {
792  sprintf(histname, "LCT_CSCId, station %d", istat+1);
793  hLctTMBChamber[istat] = fs->make<TH1F>("", histname, 10, -0.5, 9.5);
794  }
795 
796  hLctTMBKeyGroupME11 = fs->make<TH1F>("hLctTMBKeyGroupME11", "LCT key wiregroup ME1/1", 50, -0.5, 49.5);
797  hLctTMBKeyStripME11 = fs->make<TH1F>("hLctTMBKeyStripME11", "LCT key strip ME1/1", 161, -0.5, 160.5);
798 
799  bookedLCTTMBHistos = true;
800  std::cout <<" bookedLCTTMBHistos " << std::endl;
801 }
static const int NCHAMBERS[CSC_TYPES]
static const std::string csc_type_minus[CSC_TYPES]
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
TH1F * hLctTMBCsc[MAX_ENDCAPS][CSC_TYPES]
static const std::string csc_type_plus[CSC_TYPES]
void CSCTriggerPrimitivesReader::bookResolHistos ( )
private

Definition at line 1046 of file CSCTriggerPrimitivesReader.cc.

References bookedResolHistos, csc_type, CSC_TYPES, debug, hAlctVsEta, hClctVsPhi, hEtaDiffCsc, hEtaDiffVsEta, hEtaDiffVsWireCsc, hEtaRecVsSim, hPhiDiffCsc, hPhiDiffPattern, hPhiDiffVsPhi, hPhiDiffVsStripCsc, hPhiRecVsSim, hResolDeltaDS, hResolDeltaEta, hResolDeltaHS, hResolDeltaPhi, hResolDeltaPhiDS, hResolDeltaPhiHS, hResolDeltaWG, hTrueBendCsc, mps_fire::i, LogTrace, TFileService::make(), MAX_HS, MAX_STATIONS, MAX_WG, CSCConstants::NUM_CLCT_PATTERNS, ptype_TMB07, genVertex_cff::t0, TWOPI, MetAnalyzer::u1, and MetAnalyzer::u2.

Referenced by calcResolution().

1046  {
1048 
1049  // Limits for resolution histograms
1050  const double EDMIN = -0.05; // eta min
1051  const double EDMAX = 0.05; // eta max
1052  const double PDMIN = -5.0; // phi min (mrad)
1053  const double PDMAX = 5.0; // phi max (mrad)
1054 
1055  hResolDeltaWG = fs->make<TH1F>("", "Delta key wiregroup", 10, -5., 5.);
1056 
1057  hResolDeltaHS = fs->make<TH1F>("", "Delta key halfstrip", 10, -5., 5.);
1058  hResolDeltaDS = fs->make<TH1F>("", "Delta key distrip", 10, -5., 5.);
1059 
1060  hResolDeltaEta = fs->make<TH1F>("", "#eta_rec-#eta_sim", 100, EDMIN, EDMAX);
1061  hResolDeltaPhi = fs->make<TH1F>("", "#phi_rec-#phi_sim (mrad)", 100, -10., 10.);
1062  hResolDeltaPhiHS = fs->make<TH1F>("", "#phi_rec-#phi_sim (mrad), halfstrips", 100, -10., 10.);
1063  hResolDeltaPhiDS = fs->make<TH1F>("", "#phi_rec-#phi_sim (mrad), distrips", 100, -10., 10.);
1064 
1065  hEtaRecVsSim = fs->make<TH2F>("", "#eta_rec vs #eta_sim", 64, 0.9, 2.5, 64, 0.9, 2.5);
1066  hPhiRecVsSim = fs->make<TH2F>("", "#phi_rec vs #phi_sim", 100, 0., TWOPI, 100, 0., TWOPI);
1067 
1068  // LCT quantities per station
1069  char histname[60];
1070  for (int i = 0; i < MAX_STATIONS; i++) {
1071  sprintf(histname, "ALCTs vs eta, station %d", i+1);
1072  hAlctVsEta[i] = fs->make<TH1F>("", histname, 66, 0.875, 2.525);
1073 
1074  sprintf(histname, "CLCTs vs phi, station %d", i+1);
1075  hClctVsPhi[i] = fs->make<TH1F>("", histname, 100, 0., TWOPI);
1076 
1077  sprintf(histname, "#LT#eta_rec-#eta_sim#GT, station %d", i+1);
1078  hEtaDiffVsEta[i] = fs->make<TH1F>("", histname, 66, 0.875, 2.525);
1079 
1080  sprintf(histname, "#LT#phi_rec-#phi_sim#GT, station %d", i+1);
1081  hPhiDiffVsPhi[i] = fs->make<TH1F>("", histname, 100, 0., TWOPI);
1082  }
1083 
1084  for (int i = 0; i < CSC_TYPES; i++) {
1085  string t0 = "#eta_rec-#eta_sim, " + csc_type[i];
1086  hEtaDiffCsc[i][0] = fs->make<TH1F>("", t0.c_str(), 100, EDMIN, EDMAX);
1087  string t1 = t0 + ", endcap1";
1088  hEtaDiffCsc[i][1] = fs->make<TH1F>("", t1.c_str(), 100, EDMIN, EDMAX);
1089  string t2 = t0 + ", endcap2";
1090  hEtaDiffCsc[i][2] = fs->make<TH1F>("", t2.c_str(), 100, EDMIN, EDMAX);
1091 
1092  string t4 = "#eta_rec-#eta_sim vs wiregroup, " + csc_type[i];
1093  hEtaDiffVsWireCsc[i] =
1094  fs->make<TH2F>("", t4.c_str(), MAX_WG[i], 0., MAX_WG[i], 100, EDMIN, EDMAX);
1095 
1096  string u0 = "#phi_rec-#phi_sim, " + csc_type[i];
1097  hPhiDiffCsc[i][0] = fs->make<TH1F>("", u0.c_str(), 100, PDMIN, PDMAX);
1098  string u1 = u0 + ", endcap1";
1099  hPhiDiffCsc[i][1] = fs->make<TH1F>("", u1.c_str(), 100, PDMIN, PDMAX);
1100  string u2 = u0 + ", endcap2";
1101  hPhiDiffCsc[i][2] = fs->make<TH1F>("", u2.c_str(), 100, PDMIN, PDMAX);
1102  hPhiDiffCsc[i][3] = fs->make<TH1F>("", u0.c_str(), 100, PDMIN, PDMAX);
1103  hPhiDiffCsc[i][4] = fs->make<TH1F>("", u0.c_str(), 100, PDMIN, PDMAX);
1104 
1105  int MAX_DS = MAX_HS[i]/4;
1106  string u5 = "#phi_rec-#phi_sim (mrad) vs distrip, " + csc_type[i];
1107  hPhiDiffVsStripCsc[i][0] =
1108  fs->make<TH2F>("", u5.c_str(), MAX_DS, 0., MAX_DS, 100, PDMIN, PDMAX);
1109  string u6 = "#phi_rec-#phi_sim (mrad) vs halfstrip, " + csc_type[i];
1110  hPhiDiffVsStripCsc[i][1] =
1111  fs->make<TH2F>("", u6.c_str(), MAX_HS[i], 0., MAX_HS[i], 100, PDMIN, PDMAX);
1112 
1113  string u7 = "#phi(layer 1)-#phi(layer 6), mrad, " + csc_type[i];
1114  hTrueBendCsc[i] =fs->make<TH1F>("", u7.c_str(), 100, -10., 10.);
1115  }
1116 
1117  int max_patterns, phibend;
1118  max_patterns = CSCConstants::NUM_CLCT_PATTERNS;
1119  for (int i = 0; i < max_patterns; i++) {
1120  phibend = ptype_TMB07[i];
1121  sprintf(histname, "#phi_rec-#phi_sim, bend = %d", phibend);
1122  hPhiDiffPattern[i] = fs->make<TH1F>("", histname, 100, PDMIN, PDMAX);
1123  }
1124 
1125  bookedResolHistos = true;
1126  if (debug) LogTrace("CSCTriggerPrimitivesReader")
1127  <<"bookedResolHistos ";
1128 }
static const int MAX_HS[CSC_TYPES]
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
static const std::string csc_type[CSC_TYPES]
#define LogTrace(id)
TH1F * hPhiDiffPattern[CSCConstants::NUM_CLCT_PATTERNS]
static const int ptype_TMB07[CSCConstants::NUM_CLCT_PATTERNS]
static const int MAX_WG[CSC_TYPES]
void CSCTriggerPrimitivesReader::calcEfficiency ( const CSCALCTDigiCollection alcts,
const CSCCLCTDigiCollection clcts,
const edm::PSimHitContainer allSimHits 
)
private

Definition at line 2979 of file CSCTriggerPrimitivesReader.cc.

References funct::abs(), badChambers_, bookedEfficHistos, bookEfficHistos(), relativeConstraints::chamber, CSCDetId::chamber(), checkBadChambers_, CSCDetId::endcap(), makeMuonMisalignmentScenario::endcap, PV3DBase< T, PVType, FrameType >::eta(), geom_, getCSCType(), hEfficALCTEta, hEfficALCTEtaCsc, hEfficCLCTEta, hEfficCLCTEtaCsc, hEfficHitsEta, hEfficHitsEtaCsc, CSCBadChambers::isInBadChamber(), CSCDetId::layer(), CSCGeometry::layer(), LogTrace, MuonTCMETValueMapProducer_cff::nLayers, CSCConstants::NUM_LAYERS, plotME1A, relativeConstraints::ring, CSCDetId::ring(), relativeConstraints::station, CSCDetId::station(), and GeomDet::toGlobal().

Referenced by MCStudies().

2981  {
2982 
2983  // Book histos when called for the first time.
2985 
2986  // Create list of chambers having SimHits.
2987  vector<CSCDetId> chamberIds;
2988  vector<CSCDetId>::const_iterator chamberIdIt;
2989  for (const auto& simHitIt : allSimHits) {
2990  // Find detId where simHit is located.
2991  bool sameId = false;
2992  CSCDetId hitId = (CSCDetId) simHitIt.detUnitId();
2993  // Skip chambers marked as bad (includes most of ME4/2 chambers).
2994  if (checkBadChambers_ && badChambers_->isInBadChamber(hitId)) continue;
2995  //if (hitId.ring() == 4) continue; // skip ME1/A for now.
2996  if (!plotME1A && hitId.ring() == 4) continue;
2997  for (const auto& chamberId : chamberIds) {
2998  if (chamberId.endcap() == hitId.endcap() &&
2999  chamberId.station() == hitId.station() &&
3000  chamberId.ring() == hitId.ring() &&
3001  chamberId.chamber() == hitId.chamber()) {
3002  sameId = true;
3003  break;
3004  }
3005  }
3006  if (!sameId) {
3007  CSCDetId newChamberId(hitId.endcap(), hitId.station(), hitId.ring(),
3008  hitId.chamber(), 0);
3009  chamberIds.push_back(newChamberId);
3010  }
3011  }
3012  LogTrace("CSCTriggerPrimitivesReader")
3013  << "Found SimHits in " << chamberIds.size() << " CSCs";
3014 
3015  bool used[CSCConstants::NUM_LAYERS];
3016  vector<PSimHit> simHitsV[CSCConstants::NUM_LAYERS];
3017  for (const auto& chamberId : chamberIds) {
3018  // Find out how many layers of this chamber have SimHits.
3019  int nLayers = 0;
3020  for (int ilayer = 0; ilayer < CSCConstants::NUM_LAYERS; ilayer++) {
3021  used[ilayer] = false;
3022  simHitsV[ilayer].clear();
3023  }
3024 
3025  int endcap = chamberId.endcap();
3026  int station = chamberId.station();
3027  int ring = chamberId.ring();
3028  int chamber = chamberId.chamber();
3029  for (const auto& simHitIt : allSimHits) {
3030  CSCDetId hitId = (CSCDetId) simHitIt.detUnitId();
3031  if (hitId.endcap() == endcap && hitId.station() == station &&
3032  hitId.ring() == ring && hitId.chamber() == chamber) {
3033  int layer = hitId.layer() - 1;
3034  if (!used[layer] && abs(simHitIt.particleType()) == 13) {
3035  nLayers++;
3036  used[layer] = true;
3037  simHitsV[layer].push_back(simHitIt);
3038  }
3039  }
3040  }
3041  LogTrace("CSCTriggerPrimitivesReader")
3042  << "CSC in ME" << ((endcap == 1) ? "+" : "-")
3043  << station << "/" << ring << "/" << chamber
3044  << " has muon hits in " << nLayers << " layers";
3045 
3046  // If the number of layers with hits is above threshold, look for
3047  // a presence of LCTs.
3048  if (nLayers > 3) { // Should be a parameter.
3049  // Start with the key layer and take the eta of the first hit.
3050  // Really crude; should be improved.
3051  double hitEta = -999.;
3052  for (int ilayer = 2; ilayer < CSCConstants::NUM_LAYERS; ilayer++) {
3053  vector<PSimHit> layerSimHitsV = simHitsV[ilayer];
3054  if (layerSimHitsV.size() > 0) {
3055  LocalPoint hitLP = layerSimHitsV[0].localPosition();
3056  CSCDetId layerId = (CSCDetId)(layerSimHitsV[0]).detUnitId();
3057  const CSCLayer* csclayer = geom_->layer(layerId);
3058  GlobalPoint hitGP = csclayer->toGlobal(hitLP);
3059  hitEta = hitGP.eta();
3060  break;
3061  }
3062  }
3063  if (hitEta < -3.) {
3064  edm::LogWarning("L1CSCTPEmulatorWrongValues")
3065  << "+++ Warning in calcEfficiency(): no SimHit found"
3066  << " where there must be at least " << nLayers << "! +++\n";
3067  continue;
3068  }
3069  int csctype = getCSCType(*chamberIdIt);
3070  hEfficHitsEta[station-1]->Fill(fabs(hitEta));
3071  hEfficHitsEtaCsc[csctype]->Fill(fabs(hitEta));
3072 
3073  bool isALCT = false;
3074  for (auto adetUnitIt = alcts->begin(); adetUnitIt != alcts->end();
3075  adetUnitIt++) {
3076  const CSCDetId& id = (*adetUnitIt).first;
3077  if (id == (*chamberIdIt)) {
3078  const auto& range = (*adetUnitIt).second;
3079  for (auto digiIt = range.first;
3080  digiIt != range.second; digiIt++) {
3081  if (digiIt->isValid()) {
3082  // Check the distance??
3083  LogTrace("CSCTriggerPrimitivesReader") << "ALCT was found";
3084  isALCT = true;
3085  break;
3086  }
3087  }
3088  }
3089  if (isALCT) break;
3090  }
3091  if (isALCT) {
3092  hEfficALCTEta[station-1]->Fill(fabs(hitEta));
3093  hEfficALCTEtaCsc[csctype]->Fill(fabs(hitEta));
3094  }
3095  else {
3096  LogTrace("CSCTriggerPrimitivesReader") << "ALCT was not found";
3097  }
3098 
3099  bool isCLCT = false;
3100  for (auto cdetUnitIt = clcts->begin(); cdetUnitIt != clcts->end();
3101  cdetUnitIt++) {
3102  const CSCDetId& id = (*cdetUnitIt).first;
3103  if (id == (*chamberIdIt)) {
3104  const auto& range = (*cdetUnitIt).second;
3105  for (auto digiIt = range.first;
3106  digiIt != range.second; digiIt++) {
3107  if (digiIt->isValid()) {
3108  // Check the distance??
3109  LogTrace("CSCTriggerPrimitivesReader") << "CLCT was found";
3110  isCLCT = true;
3111  break;
3112  }
3113  }
3114  }
3115  if (isCLCT) break;
3116  }
3117  if (isCLCT) {
3118  hEfficCLCTEta[station-1]->Fill(fabs(hitEta));
3119  hEfficCLCTEtaCsc[csctype]->Fill(fabs(hitEta));
3120  }
3121  else {
3122  LogTrace("CSCTriggerPrimitivesReader") << "CLCT was not found";
3123  }
3124 
3125  }
3126  }
3127 }
int chamber() const
Definition: CSCDetId.h:68
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
int layer() const
Definition: CSCDetId.h:61
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index &#39;ichamber&#39; flagged as bad?
int endcap() const
Definition: CSCDetId.h:93
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define LogTrace(id)
int ring() const
Definition: CSCDetId.h:75
T eta() const
Definition: PV3DBase.h:76
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:139
int station() const
Definition: CSCDetId.h:86
void CSCTriggerPrimitivesReader::calcResolution ( const CSCALCTDigiCollection alcts,
const CSCCLCTDigiCollection clcts,
const CSCWireDigiCollection wiredc,
const CSCComparatorDigiCollection compdc,
const edm::PSimHitContainer allSimHits 
)
private

Definition at line 2787 of file CSCTriggerPrimitivesReader.cc.

References funct::abs(), badChambers_, bookedResolHistos, bookResolHistos(), relativeConstraints::chamber, checkBadChambers_, debug, spr::deltaEta, hiPixelPairStep_cff::deltaPhi, makeMuonMisalignmentScenario::endcap, geom_, getCSCType(), getHsPerRad(), CSCAnodeLCTAnalyzer::getSimInfo(), CSCCathodeLCTAnalyzer::getSimInfo(), CSCCathodeLCTAnalyzer::getStripPhi(), CSCAnodeLCTAnalyzer::getWGEta(), hAlctVsEta, hClctVsPhi, hEtaDiffCsc, hEtaDiffVsEta, hEtaDiffVsWireCsc, hEtaRecVsSim, hPhiDiffCsc, hPhiDiffPattern, hPhiDiffVsPhi, hPhiDiffVsStripCsc, hPhiRecVsSim, hResolDeltaDS, hResolDeltaEta, hResolDeltaHS, hResolDeltaPhi, hResolDeltaPhiDS, hResolDeltaPhiHS, hResolDeltaWG, hTrueBendCsc, CSCBadChambers::isInBadChamber(), CSCConstants::KEY_ALCT_LAYER, CSCConstants::KEY_CLCT_LAYER, CSCDetId::layer(), CSCGeometry::layer(), LogTrace, M_PI, CSCCathodeLCTAnalyzer::nearestHS(), CSCAnodeLCTAnalyzer::nearestWG(), phi, relativeConstraints::ring, CSCAnodeLCTAnalyzer::setGeometry(), CSCCathodeLCTAnalyzer::setGeometry(), relativeConstraints::station, digitizers_cfi::strip, and GeomDet::toGlobal().

Referenced by MCStudies().

2790  {
2791 
2792  // Book histos when called for the first time.
2794 
2795  // ALCT resolution
2796  CSCAnodeLCTAnalyzer alct_analyzer;
2797  alct_analyzer.setGeometry(geom_);
2798 
2799  for (auto adetUnitIt = alcts->begin(); adetUnitIt != alcts->end(); adetUnitIt++) {
2800  const CSCDetId& id = (*adetUnitIt).first;
2801  if (checkBadChambers_ && badChambers_->isInBadChamber(id)) continue;
2802  const auto& range = (*adetUnitIt).second;
2803  for (auto digiIt = range.first;
2804  digiIt != range.second; digiIt++) {
2805 
2806  bool alct_valid = (*digiIt).isValid();
2807  if (alct_valid) {
2808  vector<CSCAnodeLayerInfo> alctInfo =
2809  alct_analyzer.getSimInfo(*digiIt, id, wiredc, &allSimHits);
2810 
2811  double hitPhi = -999.0, hitEta = -999.0;
2812  int hitWG = alct_analyzer.nearestWG(alctInfo, hitPhi, hitEta);
2813  if (hitWG >= 0.) {
2814  // Key wire group and key layer id.
2815  int wiregroup = (*digiIt).getKeyWG();
2816 
2817  CSCDetId layerId(id.endcap(), id.station(), id.ring(),
2819  int endc = id.endcap();
2820  int stat = id.station();
2821  int csctype = getCSCType(id);
2822 
2823  double alctEta = alct_analyzer.getWGEta(layerId, wiregroup);
2824  double deltaEta = alctEta - hitEta;
2825  hResolDeltaEta->Fill(deltaEta);
2826 
2827  double deltaWG = wiregroup - hitWG;
2828  if (debug) LogTrace("CSCTriggerPrimitivesReader")
2829  << "WG: MC = " << hitWG << " rec = " << wiregroup
2830  << " delta = " << deltaWG;
2831  hResolDeltaWG->Fill(deltaWG);
2832 
2833  hEtaRecVsSim->Fill(fabs(hitEta), fabs(alctEta));
2834  hEtaDiffCsc[csctype][0]->Fill(deltaEta);
2835  hEtaDiffCsc[csctype][endc]->Fill(deltaEta);
2836  hAlctVsEta[stat-1]->Fill(fabs(alctEta));
2837  hEtaDiffVsEta[stat-1]->Fill(fabs(alctEta), fabs(deltaEta));
2838  hEtaDiffVsWireCsc[csctype]->Fill(wiregroup, deltaEta);
2839  }
2840  // should I comment out this "else"?
2841  //else {
2842  // edm::LogWarning("L1CSCTPEmulatorWrongInput")
2843  // << "+++ Warning in calcResolution(): no matched SimHit"
2844  // << " found! +++\n";
2845  //}
2846  }
2847  }
2848  }
2849 
2850  // CLCT resolution
2851  static const int key_layer = CSCConstants::KEY_CLCT_LAYER;
2852  CSCCathodeLCTAnalyzer clct_analyzer;
2853  clct_analyzer.setGeometry(geom_);
2854 
2855  for (auto cdetUnitIt = clcts->begin(); cdetUnitIt != clcts->end(); cdetUnitIt++) {
2856  const CSCDetId& id = (*cdetUnitIt).first;
2857  if (checkBadChambers_ && badChambers_->isInBadChamber(id)) continue;
2858  const auto& range = (*cdetUnitIt).second;
2859  for (auto digiIt = range.first;
2860  digiIt != range.second; digiIt++) {
2861 
2862  bool clct_valid = (*digiIt).isValid();
2863  if (clct_valid) {
2864  vector<CSCCathodeLayerInfo> clctInfo =
2865  clct_analyzer.getSimInfo(*digiIt, id, compdc, &allSimHits);
2866 
2867  double hitPhi = -999.0, hitEta = -999.0, deltaStrip = -999.0;
2868  int hitHS = clct_analyzer.nearestHS(clctInfo, hitPhi, hitEta);
2869  if (hitHS >= 0.) {
2870  // Key strip and key layer id.
2871  int halfstrip = (*digiIt).getKeyStrip();
2872  int strip = halfstrip/2;
2873  int distrip = halfstrip/4;
2874  int stripType = (*digiIt).getStripType();
2875 
2876  CSCDetId layerId(id.endcap(), id.station(), id.ring(),
2877  id.chamber(), key_layer);
2878  int endc = id.endcap();
2879  int stat = id.station();
2880  int csctype = getCSCType(id);
2881 
2882  // 'float strip' is in the units of 'strip', i.e., angular
2883  // widths of each strip. The counting is from 0.0 at the extreme
2884  // edge of the 'first' strip at one edge of the detector.
2885  float fstrip = -999.;
2886  if (stripType == 0) { // di-strip CLCT
2887  fstrip = strip + 1.;
2888  }
2889  else { // half-strip CLCT
2890  fstrip = strip + 0.5*(halfstrip%2) + 0.25;
2891  }
2892  double clctPhi = clct_analyzer.getStripPhi(layerId, fstrip);
2893  double deltaPhi = clctPhi - hitPhi;
2894  if (deltaPhi < -M_PI) deltaPhi += 2.*M_PI;
2895  else if (deltaPhi > M_PI) deltaPhi -= 2.*M_PI;
2896  deltaPhi *= 1000; // in mrad
2897  if (hitPhi < 0) hitPhi += 2.*M_PI;
2898  if (clctPhi < 0) clctPhi += 2.*M_PI;
2899  if (debug) LogTrace("CSCTriggerPrimitivesReader")
2900  << " clctPhi = " << clctPhi << " hitPhi = " << hitPhi
2901  << " deltaPhi = " << deltaPhi;
2902 
2903  hResolDeltaPhi->Fill(deltaPhi);
2904  if (stripType == 0) { // di-strip CLCT
2905  deltaStrip = distrip - hitHS/4;
2906  hResolDeltaDS->Fill(deltaStrip);
2907  hResolDeltaPhiDS->Fill(deltaPhi);
2908  hPhiDiffVsStripCsc[csctype][0]->Fill(distrip, deltaPhi);
2909  }
2910  else { // half-strip CLCT
2911  deltaStrip = halfstrip - hitHS;
2912  hResolDeltaHS->Fill(deltaStrip);
2913  hResolDeltaPhiHS->Fill(deltaPhi);
2914  hPhiDiffVsStripCsc[csctype][1]->Fill(halfstrip, deltaPhi);
2915  }
2916  if (debug) LogTrace("CSCTriggerPrimitivesReader")
2917  << "Half-strip: MC = " << hitHS << " rec = " << halfstrip
2918  << " pattern type = " << stripType << " delta = " << deltaStrip;
2919 
2920  hPhiRecVsSim->Fill(hitPhi, clctPhi);
2921  hPhiDiffCsc[csctype][0]->Fill(deltaPhi);
2922  hPhiDiffCsc[csctype][endc]->Fill(deltaPhi);
2923  hPhiDiffCsc[csctype][stripType+3]->Fill(deltaPhi);
2924  hClctVsPhi[stat-1]->Fill(clctPhi);
2925  hPhiDiffVsPhi[stat-1]->Fill(clctPhi, fabs(deltaPhi));
2926 
2927  // Histograms to check phi offsets for various pattern types
2928  if (stripType == 1) { // half-strips
2929  double hsperrad = getHsPerRad(csctype); // halfstrips-per-radian
2930  if((endc == 1 && (stat == 1 || stat == 2)) ||
2931  (endc == 2 && (stat == 3 || stat == 4))) {
2932  hPhiDiffPattern[(*digiIt).getPattern()]->Fill(deltaPhi/1000*hsperrad);
2933  }
2934  }
2935  }
2936  // should I comment out this "else"?
2937  //else {
2938  // edm::LogWarning("L1CSCTPEmulatorWrongInput")
2939  // << "+++ Warning in calcResolution(): no matched SimHit"
2940  // << " found! +++\n";
2941  //}
2942 
2943  // "True bend", defined as difference in phi between muon hit
2944  // positions in the first and in the sixth layers.
2945  double phi1 = -999.0, phi6 = -999.0;
2946  vector<CSCCathodeLayerInfo>::const_iterator pli;
2947  for (pli = clctInfo.begin(); pli != clctInfo.end(); pli++) {
2948  CSCDetId layerId = pli->getId();
2949  int layer = layerId.layer();
2950  if (layer == 1 || layer == 6) {
2951  // Get simHits in this layer.
2952  for (const auto& psh : allSimHits) {
2953  // Find detId where simHit is located.
2954  CSCDetId hitId = (CSCDetId)psh.detUnitId();
2955  if (hitId == layerId &&
2956  abs(psh.particleType()) == 13) { // muon hits only
2957  const CSCLayer* csclayer = geom_->layer(layerId);
2958  const auto& thisPoint = csclayer->toGlobal(psh.localPosition());
2959  double phi = thisPoint.phi();
2960  if (layer == 1) phi1 = phi;
2961  else if (layer == 6) phi6 = phi;
2962  break; // simply take the first suitable hit.
2963  }
2964  }
2965  }
2966  }
2967  if (phi1 > -99. && phi6 > -99.) {
2968  double deltaPhi = phi1 - phi6;
2969  if (deltaPhi > M_PI) deltaPhi -= 2.*M_PI;
2970  else if (deltaPhi < -M_PI) deltaPhi += 2.*M_PI;
2971  int csctype = getCSCType(id);
2972  hTrueBendCsc[csctype]->Fill(deltaPhi*1000.); // in mrad
2973  }
2974  }
2975  }
2976  }
2977 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
int nearestWG(const std::vector< CSCAnodeLayerInfo > &allLayerInfo, double &closestPhi, double &closestEta)
int layer() const
Definition: CSCDetId.h:61
void setGeometry(const CSCGeometry *geom)
std::vector< CSCAnodeLayerInfo > getSimInfo(const CSCALCTDigi &alct, const CSCDetId &alctId, const CSCWireDigiCollection *wiredc, const edm::PSimHitContainer *allSimHits)
static const double deltaEta
Definition: CaloConstants.h:8
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index &#39;ichamber&#39; flagged as bad?
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int nearestHS(const std::vector< CSCCathodeLayerInfo > &allLayerInfo, double &closestPhi, double &closestEta)
#define LogTrace(id)
double getWGEta(const CSCDetId &layerId, const int wiregroup)
#define M_PI
TH1F * hPhiDiffPattern[CSCConstants::NUM_CLCT_PATTERNS]
void setGeometry(const CSCGeometry *geom)
double getStripPhi(const CSCDetId &layerId, const float strip)
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:139
std::vector< CSCCathodeLayerInfo > getSimInfo(const CSCCLCTDigi &clct, const CSCDetId &clctId, const CSCComparatorDigiCollection *compdc, const edm::PSimHitContainer *allSimHits)
int CSCTriggerPrimitivesReader::chamberIX ( CSCDetId  id)

Definition at line 818 of file CSCTriggerPrimitivesReader.cc.

References makeMuonMisalignmentScenario::endcap, and relativeConstraints::station.

Referenced by compareALCTs(), compareCLCTs(), and compareLCTs().

818  {
819  int ix=1;
820  if(id.station()!=1) {
821  ix=(id.station()-2)*2+3+1;
822  }
823  ix+=id.ring()-1;
824  if(id.endcap()==2) {
825  ix*=-1;
826  }
827  return ix;
828 }
int CSCTriggerPrimitivesReader::chamberIXi ( CSCDetId  id)

Definition at line 803 of file CSCTriggerPrimitivesReader.cc.

References makeMuonMisalignmentScenario::endcap, and relativeConstraints::station.

Referenced by compareALCTs(), compareCLCTs(), and compareLCTs().

803  {
804  // 1/1 1/2 1/3 2/1 2/2 3/1 3/2 4/1 4/2 -1/1 -1/2 -1/3 -2/1 -2/2 -3/1 -3/2 -4/1 -4/2
805  //ix= 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
806  int ix=0;
807  if(id.station()!=1) {
808 
809  ix=(id.station()-2)*2+3;
810  }
811  ix+=id.ring()-1;
812  if(id.endcap()==2) {
813  ix+=9;
814  }
815  return ix;
816 }
int CSCTriggerPrimitivesReader::chamberSerial ( CSCDetId  id)

Definition at line 830 of file CSCTriggerPrimitivesReader.cc.

References RecoEcal_EventContent_cff::ec.

Referenced by compareALCTs(), and HotWires().

830  {
831  int st = id.station();
832  int ri = id.ring();
833  int ch = id.chamber();
834  int ec = id.endcap();
835  int kSerial = ch;
836  if (st == 1 && ri == 1) kSerial = ch;
837  if (st == 1 && ri == 2) kSerial = ch + 36;
838  if (st == 1 && ri == 3) kSerial = ch + 72;
839  if (st == 1 && ri == 4) kSerial = ch;
840  if (st == 2 && ri == 1) kSerial = ch + 108;
841  if (st == 2 && ri == 2) kSerial = ch + 126;
842  if (st == 3 && ri == 1) kSerial = ch + 162;
843  if (st == 3 && ri == 2) kSerial = ch + 180;
844  if (st == 4 && ri == 1) kSerial = ch + 216;
845  if (st == 4 && ri == 2) kSerial = ch + 234; // one day...
846  if (ec == 2) kSerial = kSerial + 300;
847  return kSerial;
848 }
void CSCTriggerPrimitivesReader::compare ( const CSCALCTDigiCollection alcts_data,
const CSCALCTDigiCollection alcts_emul,
const CSCCLCTDigiCollection clcts_data,
const CSCCLCTDigiCollection clcts_emul,
const CSCCLCTPreTriggerDigiCollection pretrigs_emul,
const CSCCorrelatedLCTDigiCollection lcts_data,
const CSCCorrelatedLCTDigiCollection lcts_emul 
)
private

Definition at line 1410 of file CSCTriggerPrimitivesReader.cc.

References bookCompHistos(), bookedCompHistos, compareALCTs(), compareCLCTs(), and compareLCTs().

Referenced by analyze().

1416  {
1417 
1418  // Book histos when called for the first time.
1420 
1421  // Comparisons
1422  compareALCTs(alcts_data, alcts_emul);
1423  compareCLCTs(clcts_data, clcts_emul, pretrigs_emul);
1424  compareLCTs(lcts_data, lcts_emul, alcts_data, clcts_data);
1425  //compareMPCLCTs(mpclcts_data, mpclcts_emul, alcts_data, clcts_data);
1426 }
void compareLCTs(const CSCCorrelatedLCTDigiCollection *lcts_data, const CSCCorrelatedLCTDigiCollection *lcts_emul, const CSCALCTDigiCollection *alcts_data, const CSCCLCTDigiCollection *clcts_data)
void compareCLCTs(const CSCCLCTDigiCollection *clcts_data, const CSCCLCTDigiCollection *clcts_emul, const CSCCLCTPreTriggerDigiCollection *pretrigs_emul)
void compareALCTs(const CSCALCTDigiCollection *alcts_data, const CSCALCTDigiCollection *alcts_emul)
void CSCTriggerPrimitivesReader::compareALCTs ( const CSCALCTDigiCollection alcts_data,
const CSCALCTDigiCollection alcts_emul 
)
private

Definition at line 1428 of file CSCTriggerPrimitivesReader.cc.

References funct::abs(), badChambers_, MyStubComparison::bx_corr_emul, MyStubComparison::bx_data, MyStubComparison::bx_emul, relativeConstraints::cham, CSCDetId::chamber(), MyStubComparison::chamber, chamberIX(), chamberIXi(), chamberSerial(), MyStubComparison::chambertype, checkBadChambers_, dataIsAnotherMC_, debug, MyStubComparison::endcap, CSCDetId::endcap(), PV3DBase< T, PVType, FrameType >::eta(), MyStubComparison::eta_data, MyStubComparison::eta_emul, Event_, event_tree, eventsAnalyzed, MyStubComparison::firstfill, MyStubComparison::fullbx_data, MyStubComparison::fullbx_emul, getCSCType(), getGlobalPosition(), hAlctCompFound, hAlctCompFound2, hAlctCompFound2i, hAlctCompFound2x, hAlctCompFoundCsc, hAlctCompMatch, hAlctCompMatch2, hAlctCompMatch2i, hAlctCompMatch2x, hAlctCompMatchCsc, hAlctCompSameN2, hAlctCompSameN2i, hAlctCompSameN2x, hAlctCompSameNCsc, hAlctCompTotal, hAlctCompTotal2, hAlctCompTotal2i, hAlctCompTotal2x, hAlctCompTotalCsc, MyStubComparison::has_data, MyStubComparison::has_emul, mps_fire::i, CSCDetId::iChamberType(), TreePerStub::init(), MyStubComparison::init(), CSCBadChambers::isInBadChamber(), MyStubComparison::key_WG_data, MyStubComparison::key_WG_emul, LogTrace, maxRing(), MyStubComparison::nEvents, MyStubComparison::nStub_data, MyStubComparison::nStub_emul, or, perStub, MyStubComparison::quality_data, MyStubComparison::quality_emul, DetId::rawId(), relativeConstraints::ring, CSCDetId::ring(), MyStubComparison::ring, RUN_, trackingPlots::stat, MyStubComparison::station, CSCDetId::station(), stub_tree, stubs_comparison, TreePerStub::t_chamber, TreePerStub::t_endcap, TreePerStub::t_EventNumberAnalyzed, TreePerStub::t_nStubs, TreePerStub::t_nStubs_readout, TreePerStub::t_ring, TreePerStub::t_station, MyStubComparison::totStubs_data, MyStubComparison::totStubs_emul, MyStubComparison::totStubs_emul_readout, CSCDetId::triggerCscId(), CSCDetId::triggerSector(), MyStubComparison::trknmb_data, and MyStubComparison::trknmb_emul.

Referenced by compare().

1429  {
1430  int emul_corr_bx;
1431 
1432  // Should be taken from config. parameters.
1433  int fifo_pretrig = 10;
1434  int fpga_latency = 6;
1435  int l1a_window_width = 7;
1436  // Time offset of raw hits w.r.t. the full 12-bit BXN.
1437  int rawhit_tbin_offset =
1438  (fifo_pretrig - fpga_latency) + (l1a_window_width-1)/2;
1439  // Extra difference due to additional register stages; determined
1440  // empirically.
1441  int register_delay = 2;
1442  // Loop over all chambers in search for ALCTs.
1443  std::vector<CSCALCTDigi>::const_iterator pd, pe;
1444  for (int endc = 1; endc <= 2; endc++) {
1445  for (int stat = 1; stat <= 4; stat++) {
1446  for (int ring = 1; ring <= maxRing(stat); ring++) {
1447  for (int cham = 1; cham <= 36; cham++) {
1448  // Calculate DetId. 0th layer means whole chamber.
1449  CSCDetId detid(endc, stat, ring, cham, 0);
1450 
1451  // Skip chambers marked as bad.
1452  if (checkBadChambers_ && badChambers_->isInBadChamber(detid)) continue;
1453  std::vector<CSCALCTDigi> alctV_data, alctV_emul;
1454  const auto& drange = alcts_data->get(detid);
1455  for (auto digiIt = drange.first; digiIt != drange.second; digiIt++) {
1456  if ((*digiIt).isValid()) {
1457  alctV_data.push_back(*digiIt);
1458  }
1459  }
1460 
1461  const auto& erange = alcts_emul->get(detid);
1462  std::vector<bool> bookedalctV_emul;
1463  for (auto digiIt = erange.first; digiIt != erange.second; digiIt++) {
1464  if ((*digiIt).isValid()) {
1465  alctV_emul.push_back(*digiIt);
1466  bookedalctV_emul.push_back(false);
1467  }
1468  }
1469 
1470  int ndata = alctV_data.size();
1471  int nemul = alctV_emul.size();
1472 
1473  if (ndata == 0 && nemul == 0) continue;
1474  bool firstfill = true;
1475 
1476  if (debug or (stat == 1 and ring== 1 and (ndata != nemul)) ) {
1477  ostringstream strstrm;
1478  strstrm << "\n--- ME" << ((detid.endcap() == 1) ? "+" : "-")
1479  << detid.station() << "/" << detid.ring() << "/"
1480  << detid.chamber()
1481  << " (sector " << detid.triggerSector()
1482  << " trig id. " << detid.triggerCscId() << "):\n";
1483  strstrm << " **** " << ndata << " valid data ALCTs found:\n";
1484  for (pd = alctV_data.begin(); pd != alctV_data.end(); pd++) {
1485  strstrm << " " << (*pd)
1486  << " Full BX = " << (*pd).getFullBX() << "\n";
1487  }
1488  strstrm << " **** " << nemul << " valid emul ALCTs found:\n";
1489  for (pe = alctV_emul.begin(); pe != alctV_emul.end(); pe++) {
1490  strstrm << " " << (*pe);
1491  for (pd = alctV_data.begin(); pd != alctV_data.end(); pd++) {
1492  if ((*pd).getTrknmb() == (*pe).getTrknmb()) {
1493  int emul_bx = (*pe).getBX();
1494  emul_corr_bx =
1495  emul_bx - rawhit_tbin_offset + register_delay;
1496  strstrm << " Corr BX = " << emul_corr_bx;
1497  break;
1498  }
1499  }
1500  strstrm << "\n";
1501  }
1502  LogTrace("CSCTriggerPrimitivesReader") << strstrm.str();
1503  //if (stat==1 && ring==1)
1504  // std::cout <<"ME11 CompareALCTs "<< strstrm.str()<< std::endl;
1505  }
1506 
1507  //Data, add HS quality later
1508  int perEv_nStub_data = 0;
1509  int perEv_nStub_emul = 0;
1510  perStub[0].init(RUN_, Event_);
1511  perStub[1].init(RUN_, Event_);
1512  for (pd = alctV_data.begin(); pd != alctV_data.end(); pd++){
1513  perEv_nStub_data++;
1514  }
1515  perStub[0].t_endcap = endc;
1516  perStub[0].t_station = stat;
1517  perStub[0].t_chamber = cham;
1518  perStub[0].t_ring = ring;
1520  perStub[0].t_nStubs = ndata;
1521  perStub[0].t_nStubs_readout = ndata;
1522  event_tree[0]->Fill();
1523  //Emul
1524  for (pe = alctV_emul.begin(); pe != alctV_emul.end(); pe++){
1525  perEv_nStub_emul++;
1526  }
1527  perStub[1].t_endcap = endc;
1528  perStub[1].t_station = stat;
1529  perStub[1].t_chamber = cham;
1530  perStub[1].t_ring = ring;
1532  perStub[1].t_nStubs = nemul;
1533  perStub[1].t_nStubs_readout = nemul;
1534  event_tree[1]->Fill();
1535 
1536  int csctype = getCSCType(detid);
1537  hAlctCompFoundCsc[endc-1][csctype]->Fill(cham);
1538  int mychamber = chamberSerial(detid);
1539  hAlctCompFound->Fill(mychamber);
1540  int ix = chamberIX(detid);
1541  int ix2 = chamberIXi(detid);
1542  // printf("station %i, ring %i, chamber %i, ix+(detid.ring()-1) %i\n",
1543  // detid.station(),detid.ring(),detid.chamber(),ix);
1544  if(detid.station()>1 && detid.ring()==1) {
1545  hAlctCompFound2x->Fill(ix,detid.chamber()*2);
1546  }
1547  else {
1548  hAlctCompFound2->Fill(ix,detid.chamber());
1549  }
1550  hAlctCompFound2i->Fill(ix2,detid.chamber());
1551 
1552  if (ndata != nemul) {
1553  LogTrace("CSCTriggerPrimitivesReader")
1554  << " +++ Different numbers of ALCTs found in ME"
1555  << ((endc == 1) ? "+" : "-") << stat << "/"
1556  << ring << "/" << cham
1557  << ": data = " << ndata << " emulator = " << nemul << " +++\n";
1558  }
1559  else {
1560  hAlctCompSameNCsc[endc-1][csctype]->Fill(cham);
1561  if(detid.station()>1 && detid.ring()==1) {
1562  hAlctCompSameN2x->Fill(ix,detid.chamber()*2);
1563  }
1564  else {
1565  hAlctCompSameN2->Fill(ix,detid.chamber());
1566  }
1567  hAlctCompSameN2i->Fill(ix2,detid.chamber());
1568  }
1569 
1570  for (int i = 0; i < ndata; i++) {
1571  if (alctV_data[i].isValid() == 0) continue;
1572  int data_trknmb = alctV_data[i].getTrknmb();
1573  //int data_quality = alctV_data[i].getQuality();
1574  //int data_accel = alctV_data[i].getAccelerator();
1575  //int data_collB = alctV_data[i].getCollisionB();
1576  int data_wiregroup = alctV_data[i].getKeyWG();
1577  int data_bx = alctV_data[i].getBX();
1578 
1580  stubs_comparison[0].firstfill = firstfill;
1581  if (firstfill) firstfill = false;
1583  stubs_comparison[0].endcap = endc;
1585  stubs_comparison[0].ring = ring;
1587  stubs_comparison[0].chambertype = detid.iChamberType();
1588  stubs_comparison[0].totStubs_data = ndata;
1589  stubs_comparison[0].totStubs_emul = nemul;
1591  stubs_comparison[0].nStub_data = i+1;
1592  stubs_comparison[0].has_data = true;
1593  stubs_comparison[0].quality_data = alctV_data[i].getQuality();
1594  stubs_comparison[0].key_WG_data = alctV_data[i].getKeyWG();
1595  stubs_comparison[0].bx_data = data_bx;
1596  stubs_comparison[0].fullbx_data = alctV_data[i].getFullBX();
1597  stubs_comparison[0].trknmb_data = data_trknmb;
1598  GlobalPoint gp_alct_data(getGlobalPosition(detid.rawId(), data_wiregroup, 60));
1599  stubs_comparison[0].eta_data = gp_alct_data.eta();
1600  for (int j=0; j<nemul; j++){
1601  if (alctV_emul[j].isValid() == 0) continue;
1602  if (bookedalctV_emul[j]) continue; //used alct
1603 
1604  int emul_trknmb = alctV_emul[j].getTrknmb();
1605  //int emul_quality = alctV_emul[j].getQuality();
1606  //int emul_accel = alctV_emul[j].getAccelerator();
1607  //int emul_collB = alctV_emul[j].getCollisionB();
1608  int emul_wiregroup = alctV_emul[j].getKeyWG();
1609  int emul_bx = alctV_emul[j].getBX();
1610  // Emulator BX re-calculated for comparison with BX in the data.
1611  emul_corr_bx = emul_bx - rawhit_tbin_offset + register_delay;
1612  if (dataIsAnotherMC_)
1613  emul_corr_bx = emul_bx;
1614 
1615  if (ndata == nemul) {
1616  hAlctCompTotal->Fill(mychamber);
1617  hAlctCompTotalCsc[endc-1][csctype]->Fill(cham);
1618  if(detid.station()>1 && detid.ring()==1) {
1619  hAlctCompTotal2x->Fill(ix,detid.chamber()*2);
1620  }
1621  else {
1622  hAlctCompTotal2->Fill(ix,detid.chamber());
1623  }
1624  hAlctCompTotal2i->Fill(ix2,detid.chamber());
1625  }
1626  if (data_trknmb == emul_trknmb ) {
1627  if (abs(data_wiregroup - emul_wiregroup) <= 2){
1628  hAlctCompMatchCsc[endc-1][csctype]->Fill(cham);
1629  hAlctCompMatch->Fill(mychamber);
1630  if(detid.station()>1 && detid.ring()==1) {
1631  hAlctCompMatch2x->Fill(ix,detid.chamber()*2);
1632  }
1633  else {
1634  hAlctCompMatch2->Fill(ix,detid.chamber());
1635  }
1636  hAlctCompMatch2i->Fill(ix2,detid.chamber());
1637  }
1638  if (debug) LogTrace("CSCTriggerPrimitivesReader")
1639  << " Identical ALCTs #" << data_trknmb;
1640  stubs_comparison[0].nStub_emul = j+1;
1641  stubs_comparison[0].has_emul = true;
1642  stubs_comparison[0].quality_emul = alctV_emul[j].getQuality();
1643  stubs_comparison[0].key_WG_emul = alctV_emul[j].getKeyWG();
1644  stubs_comparison[0].bx_emul = alctV_emul[j].getBX();
1645  stubs_comparison[0].trknmb_emul = emul_trknmb;
1646  GlobalPoint gp_alct_emul(getGlobalPosition(detid.rawId(), emul_wiregroup, 60));
1647  stubs_comparison[0].eta_emul = gp_alct_emul.eta();
1648  stubs_comparison[0].bx_corr_emul = emul_corr_bx;
1649  bookedalctV_emul[j] = true;
1650  break;
1651  }
1652  else {
1653  LogTrace("CSCTriggerPrimitivesReader")
1654  << " Different ALCTs #" << data_trknmb << " in ME"
1655  << ((endc == 1) ? "+" : "-") << stat << "/"
1656  << ring << "/" << cham;
1657  }
1658 
1659  }//loop emul
1660  if (debug and stubs_comparison[0].key_WG_data != stubs_comparison[0].key_WG_emul)
1661  LogTrace("CSCTriggerPrimitivesReader")
1662  <<" not matched ALCT from data "<< alctV_data[i]
1663  <<" stubs_comparison 0 key_WG_data "<<stubs_comparison[0].key_WG_data <<" key_WG_emul "<< stubs_comparison[0].key_WG_emul;
1664  //if (stat==1) std::cout <<" stub_tree filled , ring "<< stubs_comparison[0].ring << std::endl;
1665  //cout <<"ALCT data BX "<< stubs_comparison[0].bx_data <<" WG "<< stubs_comparison[0].key_WG_data <<" emul BX "<< stubs_comparison[0].bx_emul<<" emul BX corrected "<< stubs_comparison[0].bx_corr_emul <<" WG "<< stubs_comparison[0].key_WG_emul << endl;
1666  stub_tree[0]->Fill();
1667  }//loop data
1668  for (int i = 0; i<nemul; i++){
1669  if (alctV_emul[i].isValid() == 0 or bookedalctV_emul[i]) continue;
1670  int emul_bx = alctV_emul[i].getBX();
1672  stubs_comparison[0].firstfill = firstfill;
1673  if (firstfill) firstfill = false;
1675  stubs_comparison[0].endcap = endc;
1677  stubs_comparison[0].ring = ring;
1679  stubs_comparison[0].chambertype = detid.iChamberType();
1680  stubs_comparison[0].totStubs_data = ndata;
1681  stubs_comparison[0].totStubs_emul = nemul;
1683  stubs_comparison[0].nStub_data = -1;
1684  stubs_comparison[0].nStub_emul = i+1;
1685  stubs_comparison[0].has_data = false;
1686  stubs_comparison[0].has_emul = true;
1687  stubs_comparison[0].trknmb_emul = alctV_emul[i].getTrknmb();
1688  stubs_comparison[0].quality_emul = alctV_emul[i].getQuality();
1689  stubs_comparison[0].key_WG_emul = alctV_emul[i].getKeyWG();
1690  stubs_comparison[0].bx_emul = alctV_emul[i].getBX();
1691  stubs_comparison[0].fullbx_emul = alctV_emul[i].getFullBX();
1692  GlobalPoint gp_alct_emul(getGlobalPosition(detid.rawId(), alctV_emul[i].getKeyWG(), 60));
1693  stubs_comparison[0].eta_emul = gp_alct_emul.eta();
1694  // Emulator BX re-calculated for comparison with BX in the data.
1695  emul_corr_bx = emul_bx - rawhit_tbin_offset + register_delay;
1696  if (dataIsAnotherMC_)
1697  emul_corr_bx = emul_bx;
1698  stubs_comparison[0].bx_corr_emul = emul_corr_bx;
1699  stub_tree[0]->Fill();
1700  if (debug)
1701  LogTrace("CSCTriggerPrimitivesReader")
1702  <<"not matched ALCT from emulation "<< alctV_emul[i];
1703 
1704  }//loop emul
1705  }
1706  }
1707  }
1708  }
1709 }// compare ALCT
GlobalPoint getGlobalPosition(unsigned int rawId, int keWg, int keyHS) const
TH1F * hAlctCompSameNCsc[MAX_ENDCAPS][CSC_TYPES]
void init(int run, int event)
TH1F * hAlctCompTotalCsc[MAX_ENDCAPS][CSC_TYPES]
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index &#39;ichamber&#39; flagged as bad?
TH1F * hAlctCompFoundCsc[MAX_ENDCAPS][CSC_TYPES]
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define LogTrace(id)
TH1F * hAlctCompMatchCsc[MAX_ENDCAPS][CSC_TYPES]
void init(int run, int event)
void CSCTriggerPrimitivesReader::compareCLCTs ( const CSCCLCTDigiCollection clcts_data,
const CSCCLCTDigiCollection clcts_emul,
const CSCCLCTPreTriggerDigiCollection pretrigs_emul 
)
private

Definition at line 1711 of file CSCTriggerPrimitivesReader.cc.

References funct::abs(), badChambers_, MyStubComparison::bend_data, MyStubComparison::bend_emul, MyStubComparison::bend_pretrig, MyStubComparison::bx_corr_emul, MyStubComparison::bx_data, MyStubComparison::bx_emul, MyStubComparison::bx_pretrig, relativeConstraints::cham, CSCDetId::chamber(), MyStubComparison::chamber, chamberIX(), chamberIXi(), MyStubComparison::chambertype, checkBadChambers_, dataIsAnotherMC_, debug, MyStubComparison::endcap, CSCDetId::endcap(), Event_, event_tree, eventsAnalyzed, MyStubComparison::firstfill, MyStubComparison::fullbx_data, MyStubComparison::fullbx_emul, MuonDigiCollection< IndexType, DigiType >::get(), getCSCType(), getGlobalPosition(), MyStubComparison::has_data, MyStubComparison::has_emul, hClctCompFound2, hClctCompFound2i, hClctCompFound2x, hClctCompFoundCsc, hClctCompMatch2, hClctCompMatch2i, hClctCompMatch2x, hClctCompMatchCsc, hClctCompSameN2, hClctCompSameN2i, hClctCompSameN2x, hClctCompSameNCsc, hClctCompTotal2, hClctCompTotal2i, hClctCompTotal2x, hClctCompTotalCsc, mps_fire::i, CSCDetId::iChamberType(), TreePerStub::init(), MyStubComparison::init(), CSCBadChambers::isInBadChamber(), gen::k, MyStubComparison::key_hs_data, MyStubComparison::key_hs_emul, MyStubComparison::key_hs_pretrig, LogTrace, MyStubComparison::maxpattern_pretrig, MyStubComparison::maxquality_pretrig, maxRing(), MyStubComparison::nEvents, MyStubComparison::npretrig, MyStubComparison::nStub_data, MyStubComparison::nStub_emul, or, MyStubComparison::pattern_data, MyStubComparison::pattern_emul, MyStubComparison::pattern_pretrig, perStub, PV3DBase< T, PVType, FrameType >::phi(), MyStubComparison::phi_data, MyStubComparison::phi_emul, MyStubComparison::quality_data, MyStubComparison::quality_emul, MyStubComparison::quality_pretrig, DetId::rawId(), relativeConstraints::ring, CSCDetId::ring(), MyStubComparison::ring, RUN_, trackingPlots::stat, MyStubComparison::station, CSCDetId::station(), stub_tree, stubs_comparison, TreePerStub::t_chamber, TreePerStub::t_endcap, TreePerStub::t_EventNumberAnalyzed, TreePerStub::t_nStubs, TreePerStub::t_nStubs_readout, TreePerStub::t_ring, TreePerStub::t_station, MyStubComparison::totStubs_data, MyStubComparison::totStubs_emul, MyStubComparison::totStubs_emul_readout, CSCDetId::triggerCscId(), CSCDetId::triggerSector(), MyStubComparison::trknmb_data, and MyStubComparison::trknmb_emul.

Referenced by compare().

1713  {
1714  // Number of Tbins before pre-trigger for raw cathode hits.
1715  const int tbin_cathode_offset = 7;
1716  //const int tbin_cathode_offset = 8;//in MC, it became 8, Tao
1717  const int pretrig_trig_zone = 5;// max distance between CLCT key hs and pretrigger hs
1718 
1719  // Loop over all chambers in search for CLCTs.
1720  std::vector<CSCCLCTDigi>::const_iterator pd, pe;
1721  std::vector<CSCCLCTPreTriggerDigi>::const_iterator pretrig;
1722  perStub[2].init(RUN_, Event_);
1723  perStub[3].init(RUN_, Event_);
1724  for (int endc = 1; endc <= 2; endc++) {
1725  for (int stat = 1; stat <= 4; stat++) {
1726  for (int ring = 1; ring <= maxRing(stat); ring++) {
1727  for (int cham = 1; cham <= 36; cham++) {
1728  // Calculate DetId. 0th layer means whole chamber.
1729  CSCDetId detid(endc, stat, ring, cham, 0);
1730 
1731  // Skip chambers marked as bad.
1732  if (checkBadChambers_ && badChambers_->isInBadChamber(detid)) continue;
1733 
1734  std::vector<CSCCLCTDigi> clctV_data, clctV_emul;
1735  const auto& drange = clcts_data->get(detid);
1736  for (auto digiIt = drange.first; digiIt != drange.second; digiIt++) {
1737  if ((*digiIt).isValid()) {
1738  clctV_data.push_back(*digiIt);
1739  }
1740  }
1741 
1742  const auto& erange = clcts_emul->get(detid);
1743  std::vector<bool> bookedclctV_emul;
1744  for (auto digiIt = erange.first; digiIt != erange.second; digiIt++) {
1745  if ((*digiIt).isValid()) {
1746  for (auto pclct : clctV_emul){
1747  if (digiIt->getBX() != pclct.getBX() and abs(digiIt->getBX() - pclct.getBX())< 5)
1748  LogTrace("CSCTriggerPrimitivesReader") <<"Two CLCTs very close in timing!!! Special event: first clct "<< pclct <<" second clct "<<*digiIt << std::endl;
1749  }
1750  clctV_emul.push_back(*digiIt);
1751  bookedclctV_emul.push_back(false);
1752  }
1753  }
1754 
1755  std::vector<CSCCLCTPreTriggerDigi> pretrigV_emul;
1756  const auto& pretrigrange = pretrigs_emul->get(detid);
1757  for (auto pretrigIt = pretrigrange.first; pretrigIt != pretrigrange.second; pretrigIt++){
1758  if ((*pretrigIt).isValid()){
1759  pretrigV_emul.push_back(*pretrigIt);
1760  }
1761  }
1762 
1763  int ndata = clctV_data.size();
1764  int nemul = clctV_emul.size();
1765  if (ndata == 0 && nemul == 0) continue;
1766  bool firstfill = true;
1767  int nemul_readout = 0;
1768  for (pe = clctV_emul.begin(); pe != clctV_emul.end(); pe++) {
1769  for (pd = clctV_data.begin(); pd != clctV_data.end(); pd++) {
1770  int emul_bx = (*pe).getBX();
1771  int corr_bx =
1772  ((*pd).getFullBX() + emul_bx - tbin_cathode_offset) & 0x03;
1773  int bx_data = pd->getBX();
1774  //if (corr_bx == bx_data or abs(pe->getKeyStrip() - pd->getKeyStrip())<=1){//if emulated BX after correction is same as data bx, it will be readout
1775  if (corr_bx == bx_data){//if emulated BX after correction is same as data bx, it will be readout
1776  nemul_readout++;
1777  break;
1778  }
1779  }
1780  }
1781 
1782  if (debug or nemul>ndata or (ndata != nemul) or ndata != nemul_readout) {
1783  LogTrace("CSCTriggerPrimitivesReader") << " CLCTs from data "<< ndata <<" CLCTs from emul "<< nemul <<" readout "<< nemul_readout;
1784  ostringstream strstrm;
1785  strstrm << "\n--- ME" << ((detid.endcap() == 1) ? "+" : "-")
1786  << detid.station() << "/" << detid.ring() << "/"
1787  << detid.chamber()
1788  << " (sector " << detid.triggerSector()
1789  << " trig id. " << detid.triggerCscId() << "):\n";
1790  strstrm << " **** " << ndata << " valid data CLCTs found:\n";
1791  for (pd = clctV_data.begin(); pd != clctV_data.end(); pd++) {
1792  strstrm << " " << (*pd)
1793  << " Full BX = " << (*pd).getFullBX() << "\n";
1794  }
1795  strstrm << " **** " << nemul << " valid emul CLCTs found:\n";
1796  for (pe = clctV_emul.begin(); pe != clctV_emul.end(); pe++) {
1797  strstrm << " " << (*pe);
1798  for (pd = clctV_data.begin(); pd != clctV_data.end(); pd++) {
1799  if ((*pd).getTrknmb() == (*pe).getTrknmb() or abs((*pe).getKeyStrip() - (*pd).getKeyStrip())<5) {
1800  int emul_bx = (*pe).getBX();
1801  int corr_bx =
1802  ((*pd).getFullBX() + emul_bx - tbin_cathode_offset) & 0x03;
1803  strstrm << " Corr BX = " << corr_bx;
1804  break;
1805  }
1806  }
1807  strstrm << "\n";
1808  }
1809  LogTrace("CSCTriggerPrimitivesReader") << strstrm.str();
1810  }
1811  if (nemul_readout > 2){ //reduce nemul_readout to 2 by hand
1812  //cout <<"CLCT matching nemul readout is "<< nemul_readout <<", larger than 2. reduce it to 2 by hand"<<endl;
1813  nemul_readout = 2;
1814  }
1815 
1816 
1817  //Per event Fill, From Luca
1818  //Data, add HS quality later
1819  int perEv_nStub_data = 0;
1820  int perEv_nStub_emul = 0;
1821  perStub[2].init(RUN_, Event_);
1822  perStub[3].init(RUN_, Event_);
1823  for (pd = clctV_data.begin(); pd != clctV_data.end(); pd++){
1824  perEv_nStub_data++;
1825  }
1826  perStub[2].t_endcap = endc;
1827  perStub[2].t_station = stat;
1828  perStub[2].t_chamber = cham;
1829  perStub[2].t_ring = ring;
1831  perStub[2].t_nStubs = ndata;
1832  perStub[2].t_nStubs_readout = ndata;
1833  event_tree[2]->Fill();
1834  //Emul
1835  for (pe = clctV_emul.begin(); pe != clctV_emul.end(); pe++){
1836  perEv_nStub_emul++;
1837  }
1838  perStub[3].t_endcap = endc;
1839  perStub[3].t_station = stat;
1840  perStub[3].t_chamber = cham;
1841  perStub[3].t_ring = ring;
1843  perStub[3].t_nStubs = nemul;
1844  perStub[3].t_nStubs_readout = nemul_readout;
1845  event_tree[3]->Fill();
1846 
1847 
1848  int csctype = getCSCType(detid);
1849  hClctCompFoundCsc[endc-1][csctype]->Fill(cham);
1850  int ix = chamberIX(detid);
1851  int ix2 = chamberIXi(detid);
1852  if(detid.station()>1 && detid.ring()==1) {
1853  hClctCompFound2x->Fill(ix,detid.chamber()*2);
1854  }
1855  else {
1856  hClctCompFound2->Fill(ix,detid.chamber());
1857  }
1858  hClctCompFound2i->Fill(ix2,detid.chamber());
1859  if (ndata != nemul) {
1860  LogTrace("CSCTriggerPrimitivesReader")
1861  //cerr
1862  << " +++ Different numbers of CLCTs found in ME"
1863  << ((endc == 1) ? "+" : "-") << stat << "/"
1864  << ring << "/" << cham
1865  << ": data = " << ndata << " emulator = " << nemul << " +++\n";
1866  }
1867  else {
1868  hClctCompSameNCsc[endc-1][csctype]->Fill(cham);
1869  if(detid.station()>1 && detid.ring()==1) {
1870  hClctCompSameN2x->Fill(ix,detid.chamber()*2);
1871  }
1872  else {
1873  hClctCompSameN2->Fill(ix,detid.chamber());
1874  }
1875  hClctCompSameN2i->Fill(ix2,detid.chamber());
1876  }
1877  int i=-1;
1878  int testwg = 20;
1879  for (pd = clctV_data.begin(); pd != clctV_data.end(); pd++) {
1880  i++;
1881  if ((*pd).isValid() == 0) continue;
1882  int data_trknmb = (*pd).getTrknmb();
1883  int data_quality = (*pd).getQuality();
1884  int data_pattern = (*pd).getPattern();
1885  int data_striptype = (*pd).getStripType();
1886  int data_bend = (*pd).getBend();
1887  int data_keystrip = (*pd).getKeyStrip();
1888  int data_cfeb = (*pd).getCFEB();
1889  int data_bx = (*pd).getBX();
1890  int fullBX = (*pd).getFullBX(); // 12-bit full BX
1891 
1892  if (data_keystrip >= 128 and stat == 1 and ring == 1) testwg=5;
1893  else testwg = 20;
1894 
1896  stubs_comparison[1].firstfill = firstfill;
1897  if (firstfill) firstfill = false;
1899  stubs_comparison[1].endcap = endc;
1901  stubs_comparison[1].ring = ring;
1903  stubs_comparison[1].chambertype = detid.iChamberType();
1904  stubs_comparison[1].totStubs_data = ndata;
1905  stubs_comparison[1].totStubs_emul = nemul;
1906  stubs_comparison[1].totStubs_emul_readout = nemul_readout;
1907  stubs_comparison[1].nStub_data = i+1;
1908  stubs_comparison[1].has_data = true;
1909  stubs_comparison[1].quality_data = (*pd).getQuality();
1910  stubs_comparison[1].key_hs_data = (*pd).getKeyStrip();
1911  stubs_comparison[1].bend_data = (*pd).getBend();
1912  stubs_comparison[1].pattern_data = (*pd).getPattern();
1913  stubs_comparison[1].bx_data = (*pd).getBX();
1914  stubs_comparison[1].fullbx_data = (*pd).getFullBX();
1915  stubs_comparison[1].trknmb_data = data_trknmb;
1916  GlobalPoint gp_clct_data(getGlobalPosition(detid.rawId(), testwg, (*pd).getKeyStrip()));
1917  stubs_comparison[1].phi_data = gp_clct_data.phi();
1918 
1919  int j=-1;
1920  for (pe = clctV_emul.begin(); pe != clctV_emul.end(); pe++) {
1921  j++;
1922  if ((*pe).isValid() == 0) continue;
1923  if (bookedclctV_emul[j]) continue; //used alct
1924  int emul_trknmb = (*pe).getTrknmb();
1925  int emul_quality = (*pe).getQuality();
1926  int emul_pattern = (*pe).getPattern();
1927  int emul_striptype = (*pe).getStripType();
1928  int emul_bend = (*pe).getBend();
1929  int emul_keystrip = (*pe).getKeyStrip();
1930  int emul_cfeb = (*pe).getCFEB();
1931  int emul_bx = (*pe).getBX();
1932 
1933  if (abs(data_keystrip - emul_keystrip) <= 2){
1934  // Emulator BX re-calculated using 12-bit full BX number.
1935  // Used for comparison with BX in the data.
1936  int emul_corr_bx =
1937  (fullBX + emul_bx - tbin_cathode_offset) & 0x03;
1938  //std::cout <<"CLCT data_bx "<< data_bx <<" emul_corr_bx "<< emul_corr_bx << std::endl;
1939  if (dataIsAnotherMC_)
1940  emul_corr_bx = (emul_bx & 0x03);
1941  if (ndata == nemul) {
1942  hClctCompTotalCsc[endc-1][csctype]->Fill(cham);
1943  if(detid.station()>1 && detid.ring()==1) {
1944  hClctCompTotal2x->Fill(ix,detid.chamber()*2);
1945  }
1946  else {
1947  hClctCompTotal2->Fill(ix,detid.chamber());
1948  }
1949  hClctCompTotal2i->Fill(ix2,detid.chamber());
1950  }
1951  if (data_quality == emul_quality &&
1952  data_pattern == emul_pattern &&
1953  data_striptype == emul_striptype &&
1954  data_bend == emul_bend &&
1955  data_keystrip == emul_keystrip &&
1956  data_cfeb == emul_cfeb ){
1957  if (ndata == nemul) {
1958  hClctCompMatchCsc[endc-1][csctype]->Fill(cham);
1959  if(detid.station()>1 && detid.ring()==1) {
1960  hClctCompMatch2x->Fill(ix,detid.chamber()*2);
1961  }
1962  else {
1963  hClctCompMatch2->Fill(ix,detid.chamber());
1964  }
1965  hClctCompMatch2i->Fill(ix2,detid.chamber());
1966  }
1967  if (debug) LogTrace("CSCTriggerPrimitivesReader")
1968  << " Identical CLCTs #" << data_trknmb;
1969  }
1970  else {
1971  LogTrace("CSCTriggerPrimitivesReader")
1972  << " Different CLCTs #" << data_trknmb << " in ME"
1973  << ((endc == 1) ? "+" : "-") << stat << "/"
1974  << ring << "/" << cham <<" data_bx "<< data_bx <<" emul_corr_bx "<< emul_corr_bx;
1975  }
1976  stubs_comparison[1].nStub_emul = j+1;
1977  stubs_comparison[1].has_emul = true;
1978  stubs_comparison[1].quality_emul = (*pe).getQuality();
1979  stubs_comparison[1].key_hs_emul = (*pe).getKeyStrip();
1980  stubs_comparison[1].bend_emul = (*pe).getBend();
1981  stubs_comparison[1].pattern_emul = (*pe).getPattern();
1982  stubs_comparison[1].bx_emul = (*pe).getBX();
1983  stubs_comparison[1].bx_corr_emul = emul_corr_bx;
1984  stubs_comparison[1].trknmb_emul = emul_trknmb;
1985  GlobalPoint gp_clct_emul(getGlobalPosition(detid.rawId(), testwg, (*pe).getKeyStrip()));
1986  stubs_comparison[1].phi_emul = gp_clct_emul.phi();
1987  bookedclctV_emul[j] = true;
1988 
1989  //int mingap_trig_pretrig = pretrig_trig_zone*2;
1990  int num_pretrig = 0;
1991  for (pretrig = pretrigV_emul.begin(); pretrig != pretrigV_emul.end(); pretrig++){
1992  if ((*pretrig).getBX() != (*pe).getBX()) continue;
1993  int hsgap = std::abs((*pretrig).getKeyStrip() - (*pe).getKeyStrip());
1994  bool samechamber = true;
1995  if (stat == 1 and ring == 1)
1996  samechamber = (((*pretrig).getKeyStrip() <128 and (*pe).getKeyStrip() <128 ) || ((*pretrig).getKeyStrip() >= 128 and (*pe).getKeyStrip() >=128 ));
1997  if (not samechamber)
1998  continue;
1999 
2000  if (hsgap <= pretrig_trig_zone)
2001  num_pretrig ++;
2002  else
2003  continue;
2004  if ((*pretrig).getPattern() > stubs_comparison[1].maxpattern_pretrig)
2005  stubs_comparison[1].maxpattern_pretrig = (*pretrig).getPattern();
2006  if ((*pretrig).getQuality() > stubs_comparison[1].maxquality_pretrig){
2007  stubs_comparison[1].quality_pretrig = (*pretrig).getQuality();
2008  stubs_comparison[1].key_hs_pretrig = (*pretrig).getKeyStrip();
2009  stubs_comparison[1].bend_pretrig = (*pretrig).getBend();
2010  stubs_comparison[1].pattern_pretrig = (*pretrig).getPattern();
2011  stubs_comparison[1].bx_pretrig = (*pretrig).getBX();
2012  }
2013  }
2014  stubs_comparison[1].npretrig = num_pretrig;
2015  break;
2016  }//if (data_trknmb == emul_trknmb)
2017  }//loop emul
2018  if (debug and stubs_comparison[1].key_hs_data != stubs_comparison[1].key_hs_emul)
2019  LogTrace("CSCTriggerPrimitivesReader")
2020  <<"CSCDetid "<< detid <<" not matched CLCT from data "<< (*pd)
2021  <<" stubs_comparison 1 key_hs_data "<<stubs_comparison[1].key_hs_data <<" key_hs_emul "<< stubs_comparison[1].key_hs_emul << endl;
2022  //cout <<"CLCT data BX "<< stubs_comparison[1].bx_data <<" emul BX "<< stubs_comparison[1].bx_emul<<" emul BX corrected "<< stubs_comparison[1].bx_corr_emul << endl;
2023  stub_tree[1]->Fill();
2024  }//loop data
2025  for (int k=0; k<nemul; k++){
2026  if (clctV_emul[i].isValid() == 0) continue;
2027  if (bookedclctV_emul[k]) continue;
2029  stubs_comparison[1].firstfill = firstfill;
2030  if (firstfill) firstfill = false;
2032  stubs_comparison[1].endcap = endc;
2034  stubs_comparison[1].ring = ring;
2036  stubs_comparison[1].chambertype = detid.iChamberType();
2037  stubs_comparison[1].totStubs_data = ndata;
2038  stubs_comparison[1].totStubs_emul = nemul;
2039  stubs_comparison[1].totStubs_emul_readout = nemul_readout;
2040  stubs_comparison[1].trknmb_emul = clctV_emul[i].getTrknmb();
2042  stubs_comparison[1].has_data = false;
2043  stubs_comparison[1].nStub_emul = k+1;
2044  stubs_comparison[1].has_emul = true;
2045  stubs_comparison[1].quality_emul = clctV_emul[k].getQuality();
2046  stubs_comparison[1].key_hs_emul = clctV_emul[k].getKeyStrip();
2047  stubs_comparison[1].bend_emul = clctV_emul[k].getBend();
2048  stubs_comparison[1].pattern_emul = clctV_emul[k].getPattern();
2049  stubs_comparison[1].bx_emul = clctV_emul[k].getBX();
2050  stubs_comparison[1].fullbx_emul = clctV_emul[k].getFullBX();
2051  if (clctV_emul[k].getKeyStrip()>= 128 and stat == 1 and ring == 1) testwg=5;
2052  else testwg = 20;
2053  // Emulator BX NOT Known from the data.
2054  GlobalPoint gp_clct_emul(getGlobalPosition(detid.rawId(), testwg, clctV_emul[k].getKeyStrip()));
2055  stubs_comparison[1].phi_emul = gp_clct_emul.phi();
2056  bookedclctV_emul[k] = true;
2057  stub_tree[1]->Fill();
2058  }
2059  }
2060  }
2061  }
2062  } // for all chambers
2063 } // compareCLCTs
TH1F * hClctCompTotalCsc[MAX_ENDCAPS][CSC_TYPES]
GlobalPoint getGlobalPosition(unsigned int rawId, int keWg, int keyHS) const
TH1F * hClctCompFoundCsc[MAX_ENDCAPS][CSC_TYPES]
Range get(const IndexType &index) const
return the digis for a given DetUnit
void init(int run, int event)
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index &#39;ichamber&#39; flagged as bad?
TH1F * hClctCompSameNCsc[MAX_ENDCAPS][CSC_TYPES]
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define LogTrace(id)
int k[5][pyjets_maxn]
TH1F * hClctCompMatchCsc[MAX_ENDCAPS][CSC_TYPES]
void init(int run, int event)
void CSCTriggerPrimitivesReader::compareLCTs ( const CSCCorrelatedLCTDigiCollection lcts_data,
const CSCCorrelatedLCTDigiCollection lcts_emul,
const CSCALCTDigiCollection alcts_data,
const CSCCLCTDigiCollection clcts_data 
)
private

Definition at line 2065 of file CSCTriggerPrimitivesReader.cc.

References funct::abs(), badChambers_, MyStubComparison::bend_data, MyStubComparison::bend_emul, MyStubComparison::bx_corr_emul, MyStubComparison::bx_data, MyStubComparison::bx_emul, relativeConstraints::cham, CSCDetId::chamber(), MyStubComparison::chamber, chamberIX(), chamberIXi(), MyStubComparison::chambertype, checkBadChambers_, convertBXofLCT(), dataIsAnotherMC_, debug, doesALCTCrossCLCT(), MyStubComparison::endcap, CSCDetId::endcap(), PV3DBase< T, PVType, FrameType >::eta(), MyStubComparison::eta_data, MyStubComparison::eta_emul, Event_, event_tree, eventsAnalyzed, MyStubComparison::firstfill, getCSCType(), getGlobalPosition(), MyStubComparison::has_data, MyStubComparison::has_emul, hLCTCompFound2, hLCTCompFound2i, hLCTCompFound2x, hLctCompFoundCsc, hLCTCompMatch2, hLCTCompMatch2i, hLCTCompMatch2x, hLctCompMatchCsc, hLCTCompSameN2, hLCTCompSameN2i, hLCTCompSameN2x, hLctCompSameNCsc, hLCTCompTotal2, hLCTCompTotal2i, hLCTCompTotal2x, hLctCompTotalCsc, mps_fire::i, CSCDetId::iChamberType(), TreePerStub::init(), MyStubComparison::init(), CSCBadChambers::isInBadChamber(), gen::k, MyStubComparison::key_hs_data, MyStubComparison::key_hs_emul, MyStubComparison::key_WG_data, MyStubComparison::key_WG_emul, LogTrace, maxRing(), MyStubComparison::nEvents, MyStubComparison::nStub_data, MyStubComparison::nStub_emul, or, MyStubComparison::pattern_data, MyStubComparison::pattern_emul, perStub, PV3DBase< T, PVType, FrameType >::phi(), MyStubComparison::phi_data, MyStubComparison::phi_emul, MyStubComparison::quality_data, MyStubComparison::quality_emul, DetId::rawId(), relativeConstraints::ring, CSCDetId::ring(), MyStubComparison::ring, RUN_, trackingPlots::stat, MyStubComparison::station, CSCDetId::station(), stub_tree, stubs_comparison, TreePerStub::t_chamber, TreePerStub::t_endcap, TreePerStub::t_EventNumberAnalyzed, TreePerStub::t_nStubs, TreePerStub::t_nStubs_readout, TreePerStub::t_ring, TreePerStub::t_station, MyStubComparison::totStubs_data, MyStubComparison::totStubs_emul, MyStubComparison::totStubs_emul_readout, CSCDetId::triggerCscId(), CSCDetId::triggerSector(), MyStubComparison::trknmb_data, MyStubComparison::trknmb_emul, MyStubComparison::WGcrossHS_data, and MyStubComparison::WGcrossHS_emul.

Referenced by compare().

2068  {
2069  // Need ALCT and CLCT digi collections to convert emulator bx into
2070  // hardware bx.
2071  // Loop over all chambers in search for correlated LCTs.
2072  std::vector<CSCCorrelatedLCTDigi>::const_iterator pd, pe;
2073  for (int endc = 1; endc <= 2; endc++) {
2074  for (int stat = 1; stat <= 4; stat++) {
2075  for (int ring = 1; ring <= maxRing(stat); ring++) {
2076  for (int cham = 1; cham <= 36; cham++) {
2077  // Calculate DetId. 0th layer means whole chamber.
2078  CSCDetId detid(endc, stat, ring, cham, 0);
2079 
2080  // Skip chambers marked as bad.
2081  if (checkBadChambers_ && badChambers_->isInBadChamber(detid)) continue;
2082 
2083  std::vector<CSCCorrelatedLCTDigi> lctV_data, lctV_emul;
2084  std::vector<bool> bookedlctV_emul;
2085  const auto& drange = lcts_data->get(detid);
2086  for (auto digiIt = drange.first; digiIt != drange.second; digiIt++) {
2087  if ((*digiIt).isValid()) {
2088  lctV_data.push_back(*digiIt);
2089  }
2090  }
2091 
2092  const auto& erange = lcts_emul->get(detid);
2093  for (auto digiIt = erange.first; digiIt != erange.second; digiIt++) {
2094  if ((*digiIt).isValid()) {
2095  lctV_emul.push_back(*digiIt);
2096  bookedlctV_emul.push_back(false);
2097  }
2098  }
2099 
2100  int ndata = lctV_data.size();
2101  int nemul = lctV_emul.size();
2102  if (ndata == 0 && nemul == 0) continue;
2103  bool firstfill = true;
2104  int nemul_readout = 0;
2105  for (pe = lctV_emul.begin(); pe != lctV_emul.end(); pe++) {
2106  for (pd = lctV_data.begin(); pd != lctV_data.end(); pd++) {
2107  int bx_data = pd->getBX();
2108  int bx_corr = convertBXofLCT((*pe).getBX(), detid,
2109  alcts_data, clcts_data);
2110  if ((bx_data == bx_corr) or (abs(pe->getKeyWG() - pd->getKeyWG())<=2 ) ){
2111  nemul_readout++;
2112  break;
2113  }
2114 
2115  }
2116  }
2117 
2118  if (debug or nemul>ndata or (nemul_readout != ndata) or nemul != ndata) {
2119 
2120  LogTrace("CSCTriggerPrimitivesReader") << " LCTs from data "<< ndata <<" LCTs from emul "<< nemul <<" readout "<< nemul_readout;
2121  ostringstream strstrm;
2122  strstrm << "\n--- ME" << ((detid.endcap() == 1) ? "+" : "-")
2123  << detid.station() << "/" << detid.ring() << "/"
2124  << detid.chamber()
2125  << " (sector " << detid.triggerSector()
2126  << " trig id. " << detid.triggerCscId() << "):\n";
2127  strstrm << " **** " << ndata << " valid data LCTs found:\n";
2128  for (pd = lctV_data.begin(); pd != lctV_data.end(); pd++) {
2129  strstrm << " " << (*pd);
2130  }
2131  strstrm << "\n **** " << nemul << " valid emul LCTs found:\n";
2132  for (pe = lctV_emul.begin(); pe != lctV_emul.end(); pe++) {
2133  strstrm << " " << (*pe);
2134  strstrm << " corr BX = "
2135  << convertBXofLCT((*pe).getBX(), detid,
2136  alcts_data, clcts_data);
2137  strstrm << " LCT pattern = " << (*pe).getPattern();
2138  strstrm << "\n";
2139 
2140  }
2141  LogTrace("CSCTriggerPrimitivesReader") << strstrm.str();
2142  //std::cout <<"CompareLCTs "<< strstrm.str()<< std::endl;
2143  }
2144  if (nemul_readout > 2){//reduce nemul_readout to 2 by hand
2145  //cout <<"LCT matching nemul readout is "<< nemul_readout <<", larger than 2. reduce it to 2 by hand"<<endl;
2146  nemul_readout = 2;
2147  }
2148 
2149  //
2150  //Data, add HS quality later
2151  int perEv_nStub_data = 0;
2152  int perEv_nStub_emul = 0;
2153  perStub[4].init(RUN_, Event_);
2154  perStub[5].init(RUN_, Event_);
2155  for (pd = lctV_data.begin(); pd != lctV_data.end(); pd++){
2156  perEv_nStub_data++;
2157  }
2158  perStub[4].t_endcap = endc;
2159  perStub[4].t_station = stat;
2160  perStub[4].t_chamber = cham;
2161  perStub[4].t_ring = ring;
2163  perStub[4].t_nStubs = ndata;
2164  perStub[4].t_nStubs_readout = ndata;
2165  event_tree[4]->Fill();
2166  //Emul
2167  for (pe = lctV_emul.begin(); pe != lctV_emul.end(); pe++){
2168  perEv_nStub_emul++;
2169  }
2170  perStub[5].t_endcap = endc;
2171  perStub[5].t_station = stat;
2172  perStub[5].t_chamber = cham;
2173  perStub[5].t_ring = ring;
2175  perStub[5].t_nStubs = nemul;
2176  perStub[5].t_nStubs_readout = nemul_readout;
2177  event_tree[5]->Fill();
2178 
2179  int csctype = getCSCType(detid);
2180  hLctCompFoundCsc[endc-1][csctype]->Fill(cham);
2181  int ix = chamberIX(detid);
2182  int ix2 = chamberIXi(detid);
2183  if(detid.station()>1 && detid.ring()==1) {
2184  hLCTCompFound2x->Fill(ix,detid.chamber()*2);
2185  }
2186  else {
2187  hLCTCompFound2->Fill(ix,detid.chamber());
2188  }
2189  hLCTCompFound2i->Fill(ix2,detid.chamber());
2190  if (ndata != nemul) {
2191  LogTrace("CSCTriggerPrimitivesReader")
2192  //cerr
2193  << " +++ Different numbers of LCTs found in ME"
2194  << ((endc == 1) ? "+" : "-") << stat << "/"
2195  << ring << "/" << cham
2196  << ": data = " << ndata << " emulator = " << nemul << " +++\n";
2197  }
2198  else {
2199  hLctCompSameNCsc[endc-1][csctype]->Fill(cham);
2200  if(detid.station()>1 && detid.ring()==1) {
2201  hLCTCompSameN2x->Fill(ix,detid.chamber()*2);
2202  }
2203  else {
2204  hLCTCompSameN2->Fill(ix,detid.chamber());
2205  }
2206  hLCTCompSameN2i->Fill(ix2,detid.chamber());
2207  }
2208  int i =-1;
2209  for (pd = lctV_data.begin(); pd != lctV_data.end(); pd++) {
2210  i++;
2211  if ((*pd).isValid() == 0) continue;
2212  int data_trknmb = (*pd).getTrknmb();
2213  int data_quality = (*pd).getQuality();
2214  int data_wiregroup = (*pd).getKeyWG();
2215  int data_keystrip = (*pd).getStrip();
2216  int data_pattern = (*pd).getCLCTPattern();
2217  int data_striptype = (*pd).getStripType();
2218  int data_bend = (*pd).getBend();
2219  int data_bx = (*pd).getBX();
2220 
2222  stubs_comparison[2].firstfill = firstfill;
2223  if (firstfill) firstfill = false;
2225  stubs_comparison[2].endcap = endc;
2227  stubs_comparison[2].ring = ring;
2229  stubs_comparison[2].chambertype = detid.iChamberType();
2230  stubs_comparison[2].totStubs_data = ndata;
2231  stubs_comparison[2].totStubs_emul = nemul;
2232  stubs_comparison[2].totStubs_emul_readout = nemul_readout;
2233  stubs_comparison[2].nStub_data = i+1;
2234  stubs_comparison[2].has_data = true;
2235  stubs_comparison[2].quality_data = (*pd).getQuality();
2236  stubs_comparison[2].key_WG_data = (*pd).getKeyWG();
2237  stubs_comparison[2].key_hs_data = (*pd).getStrip();
2238  //cout <<" CSC detid "<< detid <<" LCT in data "<< (*pd) <<" do doesALCTCrossCLCT "<< endl;
2239  stubs_comparison[2].WGcrossHS_data = doesALCTCrossCLCT(detid, (*pd).getKeyWG(), (*pd).getStrip());
2240  stubs_comparison[2].bend_data = (*pd).getBend();
2241  stubs_comparison[2].pattern_data = (*pd).getCLCTPattern();
2242  stubs_comparison[2].bx_data = (*pd).getBX();
2243  stubs_comparison[2].trknmb_data = data_trknmb;
2244  GlobalPoint gp_lct_data(getGlobalPosition(detid.rawId(), (*pd).getKeyWG(), (*pd).getStrip()));
2245  stubs_comparison[2].eta_data = gp_lct_data.eta();
2246  stubs_comparison[2].phi_data = gp_lct_data.phi();
2247  int j=-1;
2248  for (pe = lctV_emul.begin(); pe != lctV_emul.end(); pe++) {
2249  j++;
2250  if ((*pe).isValid() == 0) continue;
2251  if (bookedlctV_emul[j]) continue; //used alct
2252  int emul_trknmb = (*pe).getTrknmb();
2253  int emul_quality = (*pe).getQuality();
2254  int emul_wiregroup = (*pe).getKeyWG();
2255  int emul_keystrip = (*pe).getStrip();
2256  int emul_pattern = (*pe).getCLCTPattern();
2257  int emul_striptype = (*pe).getStripType();
2258  int emul_bend = (*pe).getBend();
2259  int emul_bx = (*pe).getBX();
2260  if (abs(data_keystrip - emul_keystrip) <= 2 || abs(data_wiregroup - emul_wiregroup) <= 2){
2261  // Convert emulator BX into hardware BX using full 12-bit
2262  // BX words in ALCT and CLCT digi collections.
2263  int emul_corr_bx = convertBXofLCT(emul_bx, detid,
2264  alcts_data, clcts_data);
2265  //std::cout <<"LCT data_bx "<< data_bx <<" emul_corr_bx "<< emul_corr_bx << std::endl;
2266  if (dataIsAnotherMC_)
2267  emul_corr_bx = (emul_bx & 0x01);
2268 
2269  if (ndata == nemul) {
2270  hLctCompTotalCsc[endc-1][csctype]->Fill(cham);
2271  if(detid.station()>1 && detid.ring()==1) {
2272  hLCTCompTotal2x->Fill(ix,detid.chamber()*2);
2273  }
2274  else {
2275  hLCTCompTotal2->Fill(ix,detid.chamber());
2276  }
2277  hLCTCompTotal2i->Fill(ix2,detid.chamber());
2278  }
2279  if (data_quality == emul_quality &&
2280  data_wiregroup == emul_wiregroup &&
2281  data_keystrip == emul_keystrip &&
2282  data_pattern == emul_pattern &&
2283  data_striptype == emul_striptype &&
2284  data_bend == emul_bend ){
2285  if (ndata == nemul) {
2286  hLctCompMatchCsc[endc-1][csctype]->Fill(cham);
2287  if(detid.station()>1 && detid.ring()==1) {
2288  hLCTCompMatch2x->Fill(ix,detid.chamber()*2);
2289  }
2290  else {
2291  hLCTCompMatch2->Fill(ix,detid.chamber());
2292  }
2293  hLCTCompMatch2i->Fill(ix2,detid.chamber());
2294  }
2295  if (debug) LogTrace("CSCTriggerPrimitivesReader")
2296  << " Identical LCTs #" << data_trknmb;
2297  }
2298  else {
2299  LogTrace("CSCTriggerPrimitivesReader")
2300  << " Different LCTs #" << data_trknmb << " in ME"
2301  << ((endc == 1) ? "+" : "-") << stat << "/"
2302  << ring << "/" << cham <<" data_lct bx "<< data_bx<< " emul bx "<< emul_corr_bx;
2303  }
2304  stubs_comparison[2].nStub_emul = j+1;
2305  stubs_comparison[2].has_emul = true;
2306  stubs_comparison[2].quality_emul = (*pe).getQuality();
2307  stubs_comparison[2].key_WG_emul = (*pe).getKeyWG();
2308  stubs_comparison[2].key_hs_emul = (*pe).getStrip();
2309  stubs_comparison[2].bend_emul = (*pe).getBend();
2310  stubs_comparison[2].pattern_emul = (*pe).getCLCTPattern();
2311  stubs_comparison[2].bx_emul = (*pe).getBX();
2312  //cout <<" CSC detid "<< detid <<" LCT in emul "<< (*pe) <<" do doesALCTCrossCLCT "<< endl;
2313  stubs_comparison[2].WGcrossHS_emul = doesALCTCrossCLCT(detid, (*pe).getKeyWG(), (*pe).getStrip());
2314  stubs_comparison[2].bx_corr_emul = emul_corr_bx;
2315  stubs_comparison[2].trknmb_emul = emul_trknmb;
2316  GlobalPoint gp_lct_emul(getGlobalPosition(detid.rawId(), (*pe).getKeyWG(), (*pe).getStrip()));
2317  stubs_comparison[2].eta_emul = gp_lct_emul.eta();
2318  stubs_comparison[2].phi_emul = gp_lct_emul.phi();
2319  bookedlctV_emul[j] = true;
2320  break;
2321  }//if (data_trknmb == emul_trknmb)
2322  }//loop emul
2323  if (debug and stubs_comparison[2].key_hs_data != stubs_comparison[2].key_hs_emul)
2324  LogTrace("CSCTriggerPrimitivesReader")
2325  <<"CSCDetid "<< detid <<" not matched LCT from Data "<< (*pd)
2326  <<" stubs_comparison 2 key_hs_data "<<stubs_comparison[2].key_hs_data <<" key_hs_emul "<< stubs_comparison[2].key_hs_emul << endl;
2327  stub_tree[2]->Fill();
2328  }//loop data
2329  for (int k=0; k<nemul; k++){
2330  if (bookedlctV_emul[k]) continue;
2331  if (lctV_emul[i].isValid() == 0) continue;
2334  stubs_comparison[2].endcap = endc;
2336  stubs_comparison[2].ring = ring;
2338  stubs_comparison[2].chambertype = detid.iChamberType();
2339  stubs_comparison[2].totStubs_data = ndata;
2340  stubs_comparison[2].totStubs_emul = nemul;
2341  stubs_comparison[2].totStubs_emul_readout = nemul_readout;
2342  stubs_comparison[2].trknmb_emul = lctV_emul[i].getTrknmb();
2344  stubs_comparison[2].has_data = false;
2345  stubs_comparison[2].nStub_emul = k+1;
2346  stubs_comparison[2].has_emul = true;
2347  stubs_comparison[2].WGcrossHS_emul = doesALCTCrossCLCT(detid, lctV_emul[k].getKeyWG(), lctV_emul[k].getStrip());
2348  stubs_comparison[2].quality_emul = lctV_emul[k].getQuality();
2349  stubs_comparison[2].key_WG_emul = lctV_emul[k].getKeyWG();
2350  stubs_comparison[2].key_hs_emul = lctV_emul[k].getStrip();
2351  stubs_comparison[2].bend_emul = lctV_emul[k].getBend();
2352  stubs_comparison[2].pattern_emul = lctV_emul[k].getCLCTPattern();
2353  stubs_comparison[2].bx_emul = lctV_emul[k].getBX();
2354  //stubs_comparison[2].fullbx_emul = lctV_emul[k].getFullBX();
2355  // Emulator BX NOT Known from the data.
2356  GlobalPoint gp_lct_emul(getGlobalPosition(detid.rawId(), lctV_emul[k].getKeyWG(), lctV_emul[k].getStrip()));
2357  stubs_comparison[2].eta_emul = gp_lct_emul.eta();
2358  stubs_comparison[2].phi_emul = gp_lct_emul.phi();
2359  bookedlctV_emul[k] = true;
2360  stub_tree[2]->Fill();
2361 
2362  }
2363  }
2364  }
2365  }
2366  }
2367 }
GlobalPoint getGlobalPosition(unsigned int rawId, int keWg, int keyHS) const
int convertBXofLCT(const int emul_bx, const CSCDetId &detid, const CSCALCTDigiCollection *alcts_data, const CSCCLCTDigiCollection *clcts_data)
TH1F * hLctCompFoundCsc[MAX_ENDCAPS][CSC_TYPES]
bool doesALCTCrossCLCT(CSCDetId id, int key_wg, int key_hs) const
void init(int run, int event)
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index &#39;ichamber&#39; flagged as bad?
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
TH1F * hLctCompMatchCsc[MAX_ENDCAPS][CSC_TYPES]
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TH1F * hLctCompSameNCsc[MAX_ENDCAPS][CSC_TYPES]