CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/TBDataFormats/EcalTBObjects/interface/EcalTBEventHeader.h

Go to the documentation of this file.
00001 #ifndef RECECAL_ECALTBEVENTHEADER_H
00002 #define RECECAL_ECALTBEVENTHEADER_H 1
00003 
00004 #include <ostream>
00005 #include <string>
00006 #include <vector>
00007 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00008 
00016 class EcalTBEventHeader {
00017 
00018  public:
00019   
00020   EcalTBEventHeader() {};
00021   
00022   ~EcalTBEventHeader() {};
00023 
00024   typedef struct magnetsMeasurement {
00025     int    magnet6IRead_ampere;
00026     int    magnet6ISet_ampere;
00027 
00028     int    magnet7IRead_ampere;
00029     int    magnet7ISet_ampere;
00030 
00031     int    magnet7VMeas_uvolt;
00032     int    magnet7IMeas_uampere;
00033 
00034     int    magnet6VMeas_uvolt;
00035     int    magnet6IMeas_uampere;
00036   } magnetsMeasurement_t;
00037 
00039   int eventNumber() const{
00040     return eventNumber_;
00041   }
00042 
00043   int runNumber() const{
00044     return runNumber_;
00045   }
00046 
00048   short burstNumber() const{
00049     return burstNumber_;
00050   }
00051 
00053   short smInBeam() const {
00054     return smInBeam_;
00055   }
00056 
00058   int begBurstTimeSec() const{
00059     return begBurstTime_sec_;
00060   }
00061 
00063   int begBurstTimeMsec() const{
00064     return begBurstTime_msec_;
00065   }
00066 
00068   int endBurstTimeSec() const{
00069     return endBurstTime_sec_;
00070   }
00071 
00073   int endBurstTimeMsec() const{
00074     return endBurstTime_msec_;
00075   }
00076 
00078   int begBurstLV1A() const{
00079     return begBurstLV1A_;
00080   }
00081 
00083   int endBurstLV1A() const{
00084     return endBurstLV1A_;
00085   }
00086   
00087 
00088   // Return the event type: "beam", "laser", "pedestal". "error"
00089   // or a number orresponding to the orginal eventype stored in 
00090   // the RRF. 
00091   std::string eventType() const ;
00092 
00094   int dbEventType() const ;
00095 
00097   int triggerMask() const {
00098     return triggerMask_;
00099   }
00100 
00102   int date() const {
00103     return date_;
00104   }
00105 
00107 
00108   //Table supervisor information
00109   int crystalInBeam() const {
00110     return EBDetId(crystalInBeam_).ic();
00111   }
00112   int nominalCrystalInBeam() const {
00113     return EBDetId(nominalCrystalInBeam_).ic();
00114   }
00115   int nextCrystalInBeam() const {
00116     return EBDetId(nextCrystalInBeam_).ic();
00117   }
00119   unsigned int thetaTableIndex() const { return thetaTableIndex_; }
00121   unsigned int phiTableIndex() const { return phiTableIndex_; }
00123   bool tableIsMoving() const { return tableIsMoving_;} 
00125   bool tableIsMovingAtBegSpill() const { return tableIsMovingAtBegSpill_; }
00127   bool syncError() const { return syncError_; }
00128 
00131 
00139   // FIXME: add the codes used by Jean Bourotte here.
00140   enum LaserType {
00141     LBlue     = 440, 
00142     LGreen    = 495, 
00143     LRed      = 709, 
00144     LInfrared = 800  
00145   };
00147   int lightIntensity() const {
00148     return lightIntensity_;
00149   }
00151   int laserType() const {
00152     return laserType_; // returns wavelength
00153   }
00154 
00155   LaserType laserTypeName() const {
00156     LaserType laser_type;
00157     switch(laserType_){
00158     case 440:  laser_type = LBlue;       break;
00159     case 495:  laser_type = LGreen;      break;
00160     case 709:  laser_type = LRed;        break;
00161     case 800:  laser_type = LInfrared;   break;
00162     default:   laser_type = LRed;        break;
00163     }
00164     return laser_type; // returns laserTypeName
00165   }
00166 
00168   int S6ADC () const { 
00169     return S6ADC_ ; 
00170     }
00171 
00172   int  numberOfMagnetMeasurements() const { return numberOfMagnetMeasurements_; }
00173   
00174   const std::vector<magnetsMeasurement_t>&  magnetMeasurements() const { return magnetMeasurements_; }
00175 
00176   int  scaler(int scalerId) const {
00177     if (scalerId < ((int) scalers_.size() ) )
00178       return scalers_[scalerId];
00179     else
00180       return -1;
00181   }
00182   
00184   //Set Methods
00185 
00186   void setEventNumber(const int& eventNumber) { eventNumber_=eventNumber; }
00187 
00188   void setRunNumber(const int& runNumber) { runNumber_=runNumber; }
00189 
00190   void setSmInBeam(const int& smInBeam) { smInBeam_ = smInBeam; }
00191 
00192   void setBurstNumber(const short& burstNumber ) { burstNumber_=burstNumber; }
00193 
00194   void setTriggerMask(const int& triggerMask ) { triggerMask_=triggerMask; }
00195 
00196   void setBegBurstTimeSec(const int&  begBurstTimeSec) { begBurstTime_sec_ = begBurstTimeSec; }
00197 
00198   void setBegBurstTimeMsec(const int&  begBurstTimeMsec) { begBurstTime_msec_ = begBurstTimeMsec; }
00199 
00200   void setEndBurstTimeSec(const int&  endBurstTimeSec) { endBurstTime_sec_ = endBurstTimeSec; }
00201 
00202   void setEndBurstTimeMsec(const int&  endBurstTimeMsec) { endBurstTime_msec_ = endBurstTimeMsec; }
00203 
00204   void setBegBurstLV1A(const int&  begBurstLV1A) { begBurstLV1A_ = begBurstLV1A; }
00205 
00206   void setEndBurstLV1A(const int&  endBurstLV1A) { endBurstLV1A_ = endBurstLV1A; }
00207 
00208   void setDate(const int& date ) { date_=date; }
00209 
00210   void setCrystalInBeam(const DetId& crystalInBeam ) { crystalInBeam_=crystalInBeam; }
00211 
00212   void setNominalCrystalInBeam(const DetId& crystalInBeam ) { nominalCrystalInBeam_=crystalInBeam; }
00213 
00214   void setNextCrystalInBeam(const DetId& crystalInBeam ) { nextCrystalInBeam_=crystalInBeam; }
00215 
00216   void setThetaTableIndex(const unsigned int& thetaTableIndex ) { thetaTableIndex_=thetaTableIndex; }
00217 
00218   void setPhiTableIndex(const unsigned int& phiTableIndex ) { phiTableIndex_=phiTableIndex; }
00219 
00220   void setTableIsMoving(const bool& tableIsMoving ) { tableIsMoving_=tableIsMoving; }
00221 
00222   void setTableIsMovingAtBegSpill(const bool& tableIsMoving ) { tableIsMovingAtBegSpill_=tableIsMoving; }
00223 
00224   void setSyncError(const bool& syncError ) { syncError_ = syncError; }
00225 
00226   void setLightIntensity(const int& lightIntensity) { lightIntensity_=lightIntensity; }
00227 
00228   void setLaserType(const int& laserType) { laserType_ = laserType; }
00229 
00230   void setS6ADC (const int& S6ADC) { S6ADC_ = S6ADC ; }
00231 
00232   void setNumberOfMagnetMeasurements(const int& numberOfMagnetMeasurements) { numberOfMagnetMeasurements_ = numberOfMagnetMeasurements;}
00233   void setMagnetMeasurements(const std::vector<magnetsMeasurement_t>& magnetMeasurements) { magnetMeasurements_ = magnetMeasurements;}
00234 
00235   void setScalers (const std::vector<int> & scalers) { scalers_ = scalers; }
00236 
00237 
00238  private:
00239 
00240   int      eventNumber_;      
00241   int      runNumber_;        
00242   short    burstNumber_;      
00243 
00244 
00246   int      begBurstTime_sec_;
00247   int      begBurstTime_msec_;
00248   int      endBurstTime_sec_;
00249   int      endBurstTime_msec_;
00250   int      begBurstLV1A_;
00251   int      endBurstLV1A_;
00252 
00253 
00254   int      triggerMask_;      
00255 
00257   int      numberOfMagnetMeasurements_;
00258   std::vector<magnetsMeasurement_t> magnetMeasurements_;
00259   
00260   /*   int      nominalMagnet6ReadAmpere_; */
00261   /*   int      nominalMagnet7ReadAmpere_; */
00262   /*   int      nominalMagnet6SetAmpere_; */
00263   /*   int      nominalMagnet7SetAmpere_; */
00264   /*   int      measuredMagnet6MicroAmpere_; */
00265   /*   int      measuredMagnet7MicroAmpere_; */
00266   /*   int      measuredMagnet6Volt_; */
00267   /*   int      measuredMagnet7Volt_; */
00268 
00269 
00270   int      date_;             
00271 
00273   DetId    crystalInBeam_;    
00274   DetId    nominalCrystalInBeam_;    
00275   DetId    nextCrystalInBeam_;    
00276   unsigned int    thetaTableIndex_; 
00277   unsigned int    phiTableIndex_;   
00278 
00279   bool tableIsMoving_;
00280 
00281   bool tableIsMovingAtBegSpill_; //indipendent but from CAMAC one saying if table is moving at the begin of the spill
00282 
00283   //Sync error for Camac stuff
00284   bool syncError_;
00285 
00286   //FIXME for use in CMSSW(Probably unuseful when reading from new RawData Information will be stored in EcalDCCHeaderBlock)
00287   int      lightIntensity_;   
00288   int      laserType_;        
00289 
00290   int      S6ADC_ ;           
00291 
00292   short smInBeam_;
00293 
00294   // array of 36 scalers
00295   std::vector<int> scalers_;
00296 
00297 };
00298 
00299 std::ostream& operator<<(std::ostream&, const EcalTBEventHeader&);
00300   
00301 #endif