CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTTPDeadWriter.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2008/02/19 15:15:34 $
5  * $Revision: 1.1 $
6  * \author S. Bolognesi
7  */
8 
11 
18 
23 
24 /* C++ Headers */
25 #include <vector>
26 #include <set>
27 #include <iostream>
28 #include <fstream>
29 #include <string>
30 #include <sstream>
31 #include "TFile.h"
32 #include "TH1.h"
33 
34 using namespace std;
35 using namespace edm;
36 
37 
38 // Constructor
40  // get selected debug option
41  debug = pset.getUntrackedParameter<bool>("debug", "false");
42 
43  // Create the object to be written to DB
44  tpDeadList = new DTDeadFlag();
45 
46  if(debug)
47  cout << "[DTTPDeadWriter]Constructor called!" << endl;
48 }
49 
50 // Destructor
52  if(debug)
53  cout << "[DTTPDeadWriter]Destructor called!" << endl;
54 }
55 
56 void DTTPDeadWriter::beginRun(const edm::Run&, const EventSetup& setup) {
57  // Get the t0 map
58  ESHandle<DTT0> t0;
59  setup.get<DTT0Rcd>().get(t0);
60  tZeroMap = &*t0;
61 
62  // Get the muon Geometry
63  setup.get<MuonGeometryRecord>().get(muonGeom);
64 }
65 
66 // Do the job
67 void DTTPDeadWriter::analyze(const Event & event, const EventSetup& eventSetup) {
68  set<DTLayerId> analyzedLayers;
69 
70  //Loop on tzero map
71  for(DTT0::const_iterator tzero = tZeroMap->begin();
72  tzero != tZeroMap->end(); tzero++){
73 
74  //Consider what layers have been already considered
75  DTLayerId layerId = (DTWireId((*tzero).first.wheelId,
76  (*tzero).first.stationId,
77  (*tzero).first.sectorId,
78  (*tzero).first.slId,
79  (*tzero).first.layerId,
80  (*tzero).first.cellId)).layerId();
81  if(analyzedLayers.find(layerId)==analyzedLayers.end()){
82  analyzedLayers.insert(layerId);
83 
84  //Take the layer topology
85  const DTTopology& dtTopo = muonGeom->layer(layerId)->specificTopology();
86  const int firstWire = dtTopo.firstChannel();
87  //const int lastWire = dtTopo.lastChannel();
88  const int nWires = muonGeom->layer(layerId)->specificTopology().channels();
89 
90  //Loop on wires
91  for(int wire=firstWire; wire<=nWires; wire++){
92  DTWireId wireId(layerId,wire);
93  float t0 = 0;
94  float t0rms = 0;
95  tZeroMap->get(wireId,
96  t0,
97  t0rms,
99 
100  //If no t0 stored then is a tp dead channel
101  if(!t0){
102  tpDeadList->setCellDead_TP(wireId, true);
103  cout<<"Wire id "<<wireId<<" is TP dead"<<endl;
104  }
105  }
106  }
107  }
108 }
109 
110 // Write objects to DB
112  if(debug)
113  cout << "[DTTPDeadWriter]Writing ttrig object to DB!" << endl;
114 
115  // FIXME: to be read from cfg?
116  string deadRecord = "DTDeadFlagRcd";
117 
118  // Write the object to DB
119  DTCalibDBUtils::writeToDB(deadRecord, tpDeadList);
120 
121 }
122 
T getUntrackedParameter(std::string const &, T const &) const
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.
const int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:80
virtual void endJob()
Write ttrig in the DB.
tuple pset
Definition: CrabTask.py:85
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
DTTPDeadWriter(const edm::ParameterSet &pset)
Constructor.
const T & get() const
Definition: EventSetup.h:55
std::vector< std::pair< DTT0Id, DTT0Data > >::const_iterator const_iterator
Access methods to data.
Definition: DTT0.h:158
Definition: DTT0Rcd.h:9
static const double tzero[3]
tuple cout
Definition: gather_cfg.py:41
#define debug
Definition: MEtoEDMFormat.h:34
static void writeToDB(std::string record, T *payload)
virtual ~DTTPDeadWriter()
Destructor.
Definition: Run.h:31