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  * \author S. Bolognesi
5  */
6 
9 
16 
21 
22 /* C++ Headers */
23 #include <vector>
24 #include <set>
25 #include <iostream>
26 #include <fstream>
27 #include <string>
28 #include <sstream>
29 #include "TFile.h"
30 #include "TH1.h"
31 
32 using namespace std;
33 using namespace edm;
34 
35 
36 // Constructor
38  // get selected debug option
39  debug = pset.getUntrackedParameter<bool>("debug", false);
40 
41  // Create the object to be written to DB
42  tpDeadList = new DTDeadFlag();
43 
44  if(debug)
45  cout << "[DTTPDeadWriter]Constructor called!" << endl;
46 }
47 
48 // Destructor
50  if(debug)
51  cout << "[DTTPDeadWriter]Destructor called!" << endl;
52 }
53 
55  // Get the t0 map
56  ESHandle<DTT0> t0;
57  setup.get<DTT0Rcd>().get(t0);
58  tZeroMap = &*t0;
59 
60  // Get the muon Geometry
61  setup.get<MuonGeometryRecord>().get(muonGeom);
62 }
63 
64 // Do the job
65 void DTTPDeadWriter::analyze(const Event & event, const EventSetup& eventSetup) {
66  set<DTLayerId> analyzedLayers;
67 
68  //Loop on tzero map
69  for(DTT0::const_iterator tzero = tZeroMap->begin();
70  tzero != tZeroMap->end(); tzero++){
71 
72  //Consider what layers have been already considered
73 // @@@ NEW DTT0 FORMAT
74 // DTLayerId layerId = (DTWireId((*tzero).first.wheelId,
75 // (*tzero).first.stationId,
76 // (*tzero).first.sectorId,
77 // (*tzero).first.slId,
78 // (*tzero).first.layerId,
79 // (*tzero).first.cellId)).layerId();
80  int channelId = tzero->channelId;
81  if ( channelId == 0 ) continue;
82  DTLayerId layerId = (DTWireId(channelId)).layerId();
83 // @@@ NEW DTT0 END
84  if(analyzedLayers.find(layerId)==analyzedLayers.end()){
85  analyzedLayers.insert(layerId);
86 
87  //Take the layer topology
88  const DTTopology& dtTopo = muonGeom->layer(layerId)->specificTopology();
89  const int firstWire = dtTopo.firstChannel();
90  //const int lastWire = dtTopo.lastChannel();
91  const int nWires = muonGeom->layer(layerId)->specificTopology().channels();
92 
93  //Loop on wires
94  for(int wire=firstWire; wire<=nWires; wire++){
95  DTWireId wireId(layerId,wire);
96  float t0 = 0;
97  float t0rms = 0;
98  tZeroMap->get(wireId,
99  t0,
100  t0rms,
102 
103  //If no t0 stored then is a tp dead channel
104  if(!t0){
105  tpDeadList->setCellDead_TP(wireId, true);
106  cout<<"Wire id "<<wireId<<" is TP dead"<<endl;
107  }
108  }
109  }
110  }
111 }
112 
113 // Write objects to DB
115  if(debug)
116  cout << "[DTTPDeadWriter]Writing ttrig object to DB!" << endl;
117 
118  // FIXME: to be read from cfg?
119  string deadRecord = "DTDeadFlagRcd";
120 
121  // Write the object to DB
122  DTCalibDBUtils::writeToDB(deadRecord, tpDeadList);
123 
124 }
125 
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.
std::vector< DTT0Data >::const_iterator const_iterator
Access methods to data.
Definition: DTT0.h:140
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:78
virtual void endJob()
Write ttrig in the DB.
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.
#define debug
Definition: HDRShower.cc:19
const T & get() const
Definition: EventSetup.h:55
Definition: DTT0Rcd.h:9
static const double tzero[3]
tuple cout
Definition: gather_cfg.py:121
static void writeToDB(std::string record, T *payload)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
virtual ~DTTPDeadWriter()
Destructor.
Definition: Run.h:41