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: 2012/02/17 16:39:06 $
5  * $Revision: 1.3.2.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 
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 // @@@ NEW DTT0 FORMAT
76 // DTLayerId layerId = (DTWireId((*tzero).first.wheelId,
77 // (*tzero).first.stationId,
78 // (*tzero).first.sectorId,
79 // (*tzero).first.slId,
80 // (*tzero).first.layerId,
81 // (*tzero).first.cellId)).layerId();
82  int channelId = tzero->channelId;
83  if ( channelId == 0 ) continue;
84  DTLayerId layerId = (DTWireId(channelId)).layerId();
85 // @@@ NEW DTT0 END
86  if(analyzedLayers.find(layerId)==analyzedLayers.end()){
87  analyzedLayers.insert(layerId);
88 
89  //Take the layer topology
90  const DTTopology& dtTopo = muonGeom->layer(layerId)->specificTopology();
91  const int firstWire = dtTopo.firstChannel();
92  //const int lastWire = dtTopo.lastChannel();
93  const int nWires = muonGeom->layer(layerId)->specificTopology().channels();
94 
95  //Loop on wires
96  for(int wire=firstWire; wire<=nWires; wire++){
97  DTWireId wireId(layerId,wire);
98  float t0 = 0;
99  float t0rms = 0;
100  tZeroMap->get(wireId,
101  t0,
102  t0rms,
104 
105  //If no t0 stored then is a tp dead channel
106  if(!t0){
107  tpDeadList->setCellDead_TP(wireId, true);
108  cout<<"Wire id "<<wireId<<" is TP dead"<<endl;
109  }
110  }
111  }
112  }
113 }
114 
115 // Write objects to DB
117  if(debug)
118  cout << "[DTTPDeadWriter]Writing ttrig object to DB!" << endl;
119 
120  // FIXME: to be read from cfg?
121  string deadRecord = "DTDeadFlagRcd";
122 
123  // Write the object to DB
124  DTCalibDBUtils::writeToDB(deadRecord, tpDeadList);
125 
126 }
127 
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:139
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:80
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.
const T & get() const
Definition: EventSetup.h:55
Definition: DTT0Rcd.h:9
static const double tzero[3]
tuple cout
Definition: gather_cfg.py:121
#define debug
Definition: MEtoEDMFormat.h:34
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:33