CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTTPDeadWriter Class Reference

#include <DTTPDeadWriter.h>

Inheritance diagram for DTTPDeadWriter:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 Compute the ttrig by fiting the TB rising edge.
virtual void beginRun (const edm::Run &, const edm::EventSetup &setup)
 Read t0 map from event.
 DTTPDeadWriter (const edm::ParameterSet &pset)
 Constructor.
virtual void endJob ()
 Write ttrig in the DB.
virtual ~DTTPDeadWriter ()
 Destructor.

Private Attributes

bool debug
edm::ESHandle< DTGeometrymuonGeom
DTDeadFlagtpDeadList
const DTT0tZeroMap

Detailed Description

Definition at line 27 of file DTTPDeadWriter.h.


Constructor & Destructor Documentation

DTTPDeadWriter::DTTPDeadWriter ( const edm::ParameterSet pset)

Constructor.

Definition at line 39 of file DTTPDeadWriter.cc.

References gather_cfg::cout, debug, and edm::ParameterSet::getUntrackedParameter().

                                                       {
  // get selected debug option
  debug = pset.getUntrackedParameter<bool>("debug", false); 

  // Create the object to be written to DB
  tpDeadList = new DTDeadFlag();

  if(debug)
    cout << "[DTTPDeadWriter]Constructor called!" << endl;
}
DTTPDeadWriter::~DTTPDeadWriter ( ) [virtual]

Destructor.

Definition at line 51 of file DTTPDeadWriter.cc.

References gather_cfg::cout, and debug.

                               {
  if(debug)
    cout << "[DTTPDeadWriter]Destructor called!" << endl;
}

Member Function Documentation

void DTTPDeadWriter::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

Compute the ttrig by fiting the TB rising edge.

Implements edm::EDAnalyzer.

Definition at line 67 of file DTTPDeadWriter.cc.

References gather_cfg::cout, DTTopology::firstChannel(), DTTimeUnits::ns, and tzero.

                                                                              {
  set<DTLayerId> analyzedLayers;

  //Loop on tzero map
  for(DTT0::const_iterator tzero = tZeroMap->begin();
      tzero != tZeroMap->end(); tzero++){

    //Consider what layers have been already considered
// @@@ NEW DTT0 FORMAT
//    DTLayerId layerId = (DTWireId((*tzero).first.wheelId,
//                                (*tzero).first.stationId,
//                                (*tzero).first.sectorId,
//                                (*tzero).first.slId,
//                                (*tzero).first.layerId,
//                                (*tzero).first.cellId)).layerId();
    int channelId = tzero->channelId;
    if ( channelId == 0 ) continue;
    DTLayerId layerId = (DTWireId(channelId)).layerId();
// @@@ NEW DTT0 END
    if(analyzedLayers.find(layerId)==analyzedLayers.end()){
      analyzedLayers.insert(layerId);

      //Take the layer topology
      const DTTopology& dtTopo = muonGeom->layer(layerId)->specificTopology();
      const int firstWire = dtTopo.firstChannel();
      //const int lastWire = dtTopo.lastChannel();
      const int nWires = muonGeom->layer(layerId)->specificTopology().channels();

      //Loop on wires
      for(int wire=firstWire; wire<=nWires; wire++){
        DTWireId wireId(layerId,wire);
        float t0 = 0;
        float t0rms = 0;
        tZeroMap->get(wireId,
                      t0,
                      t0rms,
                      DTTimeUnits::ns);

        //If no t0 stored then is a tp dead channel
        if(!t0){
          tpDeadList->setCellDead_TP(wireId, true);
          cout<<"Wire id "<<wireId<<" is TP dead"<<endl;          
        }
      }
    }
  }
}
void DTTPDeadWriter::beginRun ( const edm::Run ,
const edm::EventSetup setup 
) [virtual]

Read t0 map from event.

Reimplemented from edm::EDAnalyzer.

Definition at line 56 of file DTTPDeadWriter.cc.

References edm::EventSetup::get().

                                                                    {
   // Get the t0 map  
   ESHandle<DTT0> t0;
   setup.get<DTT0Rcd>().get(t0);
   tZeroMap = &*t0;

   // Get the muon Geometry  
   setup.get<MuonGeometryRecord>().get(muonGeom);
}
void DTTPDeadWriter::endJob ( void  ) [virtual]

Write ttrig in the DB.

Reimplemented from edm::EDAnalyzer.

Definition at line 116 of file DTTPDeadWriter.cc.

References gather_cfg::cout, debug, and DTCalibDBUtils::writeToDB().

                            {
  if(debug) 
        cout << "[DTTPDeadWriter]Writing ttrig object to DB!" << endl;

  // FIXME: to be read from cfg?
  string deadRecord = "DTDeadFlagRcd";
  
  // Write the object to DB
  DTCalibDBUtils::writeToDB(deadRecord, tpDeadList);

}  

Member Data Documentation

bool DTTPDeadWriter::debug [private]

Definition at line 51 of file DTTPDeadWriter.h.

Definition at line 60 of file DTTPDeadWriter.h.

Definition at line 57 of file DTTPDeadWriter.h.

const DTT0* DTTPDeadWriter::tZeroMap [private]

Definition at line 54 of file DTTPDeadWriter.h.