Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-06 07:37:57

0001 #ifndef ROOT_TEcnaNumbering
0002 #define ROOT_TEcnaNumbering
0003 
0004 #include "TString.h"
0005 #include "TObject.h"
0006 #include "Riostream.h"
0007 
0008 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaObject.h"
0009 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParEcal.h"
0010 
0011 ///-----------------------------------------------------------
0012 ///   TEcnaNumbering.h
0013 ///   Update: 05/10/2012
0014 ///   Author:    B.Fabbro (bernard.fabbro@cea.fr)
0015 ///              DSM/IRFU/SPP CEA-Saclay
0016 ///   Copyright: Those valid for CEA sofware
0017 ///
0018 ///   ECNA web page:
0019 ///     http://cms-fabbro.web.cern.ch/cms-fabbro/
0020 ///     cna_new/Correlated_Noise_Analysis/ECNA_main_page.htm
0021 ///-----------------------------------------------------------
0022 
0023 class TEcnaNumbering : public TObject {
0024 private:
0025   Int_t fgMaxCar;  // Max nb of caracters for char*
0026   Int_t fCnew;     // flags for dynamical allocation
0027   Int_t fCdelete;
0028 
0029   TString fTTBELL;
0030 
0031   TString fFlagSubDet;
0032   Int_t fFlagPrint;
0033 
0034   TEcnaParEcal* fEcal;
0035 
0036   //================================= BARREL
0037 
0038   Int_t** fT2dSMCrys;
0039   Int_t* fT1dSMCrys;
0040   Int_t* fT1dSMTow;
0041   Int_t* fT1dTowEcha;
0042 
0043   TString fCodeChNumberingLvrbBot;
0044   TString fCodeChNumberingLvrbTop;
0045 
0046   //================================= ENDCAP
0047 
0048   Int_t*** fT3dDeeCrys;  // = CNA_CrysInDee[CNA_SCInDee - 1][CMS_CrysInSC - 1][CMS_DeeDir_index]
0049   Int_t** fT2dDeeCrys;
0050   Int_t* fT1dDeeCrys;
0051 
0052   Int_t** fT2dDeeSC;  // = CNA_SCInDee[CNA_CrysInDee - 1][CMS_DeeDir_index]
0053   Int_t* fT1dDeeSC;
0054 
0055   Int_t** fT2dSCEcha;  // = CMS_CrysInSC[CNA_CrysInDee - 1][CMS_DeeDir_index]
0056   Int_t* fT1dSCEcha;
0057 
0058   Int_t** fT2d_jch_JY;  // = JY[CMS_SCQuadType_index][CMS_CrysInSC - 1]
0059   Int_t* fT1d_jch_JY;
0060 
0061   Int_t** fT2d_ich_IX;  // = IX[CMS_SCQuadType_index][CMS_CrysInSC - 1]
0062   Int_t* fT1d_ich_IX;
0063 
0064   TString fCodeChNumberingITP1Bot;
0065   TString fCodeChNumberingITP2Top;
0066 
0067   Int_t** fT2d_DS;  // = DS[Dee - 1, CNA_SCInDee - 1]
0068   Int_t* fT1d_DS;
0069 
0070   Int_t** fT2d_DSSC;  // = SCInDS[Dee - 1, CNA_SCInDee - 1]
0071   Int_t* fT1d_DSSC;
0072 
0073   Int_t** fT2d_DeeSCCons;  // = SCConsInDee[Dee - 1, CNA_SCInDee - 1]
0074   Int_t* fT1d_DeeSCCons;
0075 
0076   Int_t** fT2d_RecovDeeSC;  // = CNA_SCInDee[Dee - 1, SCConsInDee - 1]
0077   Int_t* fT1d_RecovDeeSC;
0078 
0079   //........................................................................................
0080 
0081 protected:
0082   void Init();
0083 
0084 public:
0085   //------------------------------- methods
0086 
0087   TEcnaNumbering();
0088   TEcnaNumbering(TEcnaObject*, const TString&);
0089   TEcnaNumbering(const TString&, TEcnaParEcal*);
0090   ~TEcnaNumbering() override;
0091 
0092   void SetEcalSubDetector(const TString&);
0093   void SetEcalSubDetector(const TString&, TEcnaParEcal*);
0094 
0095   //================================== BARREL
0096 
0097   void BuildBarrelCrysTable();  // correspondance crystal# in super-module <-> (tower number, channel# in tower)
0098 
0099   Int_t Get1SMCrysFrom1SMTowAnd0TowEcha(const Int_t&, const Int_t&);
0100   Int_t Get0SMEchaFrom1SMTowAnd0TowEcha(const Int_t&, const Int_t&);
0101 
0102   Int_t Get0TowEchaFrom0SMEcha(const Int_t&);
0103   Int_t Get1SMTowFrom0SMEcha(const Int_t&);
0104   Int_t Get0TowEchaFrom1SMCrys(const Int_t&);
0105   Int_t Get1SMTowFrom1SMCrys(const Int_t&);
0106 
0107   Int_t GetHashedNumberFromIEtaAndIPhi(const Int_t&, const Int_t&);
0108   Int_t GetIEtaFromHashed(const Int_t&, const Int_t&);
0109   Int_t GetIPhiFromHashed(const Int_t&);
0110 
0111   //..........................................................................................................
0112   Double_t GetEta(const Int_t&, const Int_t&, const Int_t&);
0113   Double_t GetEtaMin(const Int_t&, const Int_t&);
0114   Double_t GetEtaMax(const Int_t&, const Int_t&);
0115 
0116   Double_t GetIEtaMin(const Int_t&, const Int_t&);  // only for axis of TowerCrystalNumbering (+0.5 shift)
0117   Double_t GetIEtaMax(const Int_t&, const Int_t&);  // only for axis of TowerCrystalNumbering (-0.5 shift)
0118 
0119   Double_t GetIEtaMin(const Int_t&);  // only for axis of SMTowerNumbering (+0.5 shift)
0120   Double_t GetIEtaMax(const Int_t&);  // only for axis of SMTowerNumbering (-0.5 shift)
0121 
0122   Double_t GetPhiInSM(const Int_t&, const Int_t&, const Int_t&);
0123   Double_t GetPhi(const Int_t&, const Int_t&, const Int_t&);
0124 
0125   Double_t GetPhiMin(const Int_t&, const Int_t&);
0126   Double_t GetPhiMax(const Int_t&, const Int_t&);
0127 
0128   Double_t GetJPhiMin(const Int_t&, const Int_t&);
0129   Double_t GetJPhiMax(const Int_t&, const Int_t&);
0130 
0131   Double_t GetJPhiMin(const Int_t&);
0132   Double_t GetJPhiMax(const Int_t&);
0133 
0134   Double_t GetPhiMin(const Int_t&);
0135   Double_t GetPhiMax(const Int_t&);
0136 
0137   Double_t GetSMCentralPhi(const Int_t&);
0138 
0139   TString GetXDirectionEB(const Int_t&);
0140   TString GetYDirectionEB(const Int_t&);
0141   TString GetJYDirectionEB(const Int_t&);
0142 
0143   TString GetTowerLvrbType(const Int_t&);
0144   TString GetStinLvrbType(const Int_t&);
0145 
0146   TString GetSMHalfBarrel(const Int_t&);
0147 
0148   Int_t PlusMinusSMNumber(const Int_t&);
0149 
0150   //================================== ENDCAP
0151 
0152   void BuildEndcapCrysTable();  // correspondance crystal# in Dee <-> (SC number, channel# in SC)
0153   void BuildEndcapSCTable();    // correspondance  SC# in Dee <-> (DS#, SC# in DS, SC# for construction)
0154                                 // (SC = Super Crystal, DS = Data Sector)
0155 
0156   Int_t Get1DeeCrysFrom1DeeSCEcnaAnd0SCEcha(const Int_t&, const Int_t&, const TString&);
0157 
0158   Int_t Get1SCEchaFrom0DeeEcha(const Int_t&);
0159   Int_t Get1DeeSCEcnaFrom0DeeEcha(const Int_t&);
0160   Int_t Get1SCEchaFrom1DeeCrys(const Int_t&, const TString&);
0161   Int_t Get1DeeSCEcnaFrom1DeeCrys(const Int_t&, const TString&);
0162 
0163   Int_t GetDSFrom1DeeSCEcna(const Int_t&, const Int_t&);
0164   Int_t GetDSSCFrom1DeeSCEcna(const Int_t&, const Int_t&, const Int_t&);
0165   Int_t GetDSSCFrom1DeeSCEcna(const Int_t&, const Int_t&);
0166   Int_t GetDeeSCConsFrom1DeeSCEcna(const Int_t&, const Int_t&);
0167   Int_t GetDeeSCConsFrom1DeeSCEcna(const Int_t&, const Int_t&, const Int_t&);
0168   Int_t Get1DeeSCEcnaFromDeeSCCons(const Int_t&, const Int_t&);
0169 
0170   Int_t GetIXCrysInSC(const Int_t&, const Int_t&, const Int_t&);
0171   Int_t GetJYCrysInSC(const Int_t&, const Int_t&, const Int_t&);
0172   Int_t GetIXSCInDee(const Int_t&);
0173   Int_t GetJYSCInDee(const Int_t&);
0174   Int_t GetIXCrysInDee(const Int_t&, const Int_t&, const Int_t&);
0175   Int_t GetJYCrysInDee(const Int_t&, const Int_t&, const Int_t&);
0176 
0177   Int_t GetMaxSCInDS(const Int_t&);
0178 
0179   Double_t GetIIXMin(const Int_t&);  // only for axis of SCCrystalNumbering (+0.5 shift)
0180   Double_t GetIIXMax(const Int_t&);  // only for axis of SCCrystalNumbering (-0.5 shift)
0181   Double_t GetIIXMin();              // only for axis of DeeSCNumbering (+0.5 shift)
0182   Double_t GetIIXMax();              // only for axis of DeeSCNumbering (-0.5 shift)
0183 
0184   Double_t GetJIYMin(const Int_t&, const Int_t&);
0185   Double_t GetJIYMax(const Int_t&, const Int_t&);
0186   Double_t GetJIYMin(const Int_t&);
0187   Double_t GetJIYMax(const Int_t&);
0188 
0189   Int_t GetDeeDirIndex(const TString&);
0190   Int_t GetSCQuadTypeIndex(const TString&, const TString&);
0191   TString GetDeeDirViewedFromIP(const Int_t&);
0192 
0193   TString GetSCQuadFrom1DeeSCEcna(const Int_t&);
0194   TString GetEEDeeEndcap(const Int_t&);
0195   TString GetEEDeeType(const Int_t&);
0196 
0197   TString GetDeeHalfEndcap(const Int_t&);
0198 
0199   TString GetSCType(const Int_t&);  // for special (not connected) SC's
0200 
0201   Int_t StexEchaForCons(const Int_t&, const Int_t&);
0202 
0203   TString GetXDirectionEE(const Int_t&);
0204   TString GetYDirectionEE(const Int_t&);
0205   TString GetJYDirectionEE(const Int_t&);
0206 
0207   //========================================= BARREL and ENDCAP
0208 
0209   Int_t Get1StexStinFrom0StexEcha(const Int_t&);
0210 
0211   Int_t Get0StexEchaFrom1StexStinAnd0StinEcha(const Int_t&, const Int_t&);
0212   Int_t Get1StexCrysFrom1StexStinAnd0StinEcha(const Int_t&, const Int_t&, const Int_t&);  // last arg = Stex Number
0213 
0214   Double_t GetIHocoMin(const Int_t&, const Int_t&);  // only for axis of TowerCrystalNumbering (+0.5 shift)
0215   Double_t GetIHocoMax(const Int_t&, const Int_t&);  // only for axis of TowerCrystalNumbering (-0.5 shift)
0216 
0217   Double_t GetVecoMin(const Int_t&, const Int_t&);
0218   Double_t GetVecoMax(const Int_t&, const Int_t&);
0219 
0220   Double_t GetJVecoMin(const Int_t&, const Int_t&);
0221   Double_t GetJVecoMax(const Int_t&, const Int_t&);
0222 
0223   TString GetStexHalfStas(const Int_t&);
0224 
0225   Int_t GetSMFromFED(const Int_t&);  // SM = SuperModule
0226   Int_t GetDSFromFED(const Int_t&);  // DS = DataSector
0227 
0228   Int_t MaxCrysInStinEcna(const Int_t&, const Int_t&, const TString&);  // for not connected and incomplete SC's
0229 
0230   ClassDefOverride(TEcnaNumbering, 1)  //Channel Numbering for CNA
0231 };
0232 #endif