42 #include "TPostScript.h"
53 cout<<
"[DTAlbertoBenvenutiTask]: Constructor"<<endl;
59 tMax =
parameters.getParameter<
int>(
"defaultTmax");
69 cout <<
"DTAlbertoBenvenutiTask: analyzed " <<
nevents <<
" events" << endl;
77 cout<<
"[DTAlbertoBenvenutiTask] endjob called!"<<endl;
79 map< DTChamberId, vector<TH1F*> > TBMap_perChamber;
81 for(map<DTWireId, TH1F* >::const_iterator wHisto = TBMap.begin();
82 wHisto != TBMap.end();
84 DTChamberId chId = (*wHisto).first.layerId().superlayerId().chamberId();
85 TBMap_perChamber[chId].push_back((*wHisto).second);
89 for(
map<
DTChamberId, vector<TH1F*> >::const_iterator Histo = TBMap_perChamber.begin();
90 Histo != TBMap_perChamber.end();
92 stringstream
station; station << (*Histo).first.station();
93 stringstream sector; sector << (*Histo).first.sector();
94 stringstream wheel; wheel << (*Histo).first.wheel();
96 string fileTag =
"TimeBoxes";
99 +
"_Sec" + sector.str()
100 +
"_St" + station.str()
103 TPostScript psFile(fileName.c_str(),111);
106 TCanvas
c1(
"c1",
"",600,780);
110 cout<<
"[DTAlbertoBenvenutiTask] filling the file: "<<fileName<<endl;
111 for(vector<TH1F*>::const_iterator tbHisto = (*Histo).second.begin();
112 tbHisto != (*Histo).second.end();
117 if(counter%16 == 0 && counter>=16){
134 cout<<
"[DTAlbertoBenvenutiTask]: BeginJob"<<endl;
148 if (
parameters.getUntrackedParameter<
bool>(
"readDB",
true))
152 if (
parameters.getParameter<
bool>(
"performPerWireT0Calibration"))
160 if (
debug)
cout<<
"[DTAlbertoBenvenutiTask]: booking"<<endl;
167 vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
168 vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
170 for (; ch_it != ch_end; ++ch_it) {
173 vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
174 vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
176 for(; sl_it != sl_end; ++sl_it) {
178 stringstream superLayer; superLayer << sl.
superlayer();
179 vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
180 vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
182 for(; l_it != l_end; ++l_it) {
184 stringstream layer; layer << layerId.
layer();
185 const int firstWire = muonGeom->layer(layerId)->specificTopology().firstChannel();
186 const int lastWire = muonGeom->layer(layerId)->specificTopology().lastChannel();
188 for(
int wr=firstWire; wr -lastWire <= 0; wr++) {
190 stringstream wire; wire << wr;
193 string histoTag =
"TimeBox";
194 string histoName = histoTag
196 +
"_St" + station.str()
197 +
"_Sec" + sector.str()
198 +
"_SL" + superLayer.str()
200 +
"_wire" + wire.str();
202 if (
debug)
cout<<
"[DTAlbertoBenvenutiTask]: histoName "<<histoName<<endl;
204 if (
parameters.getUntrackedParameter<
bool>(
"readDB",
false) )
208 else tTrig =
parameters.getParameter<
int>(
"defaultTtrig");
210 string histoTitle = histoName +
" (TDC Counts)";
211 int timeBoxGranularity =
parameters.getUntrackedParameter<
int>(
"timeBoxGranularity",4);
213 if (!
parameters.getUntrackedParameter<
bool>(
"readDB",
true)) {
214 int maxTDCCounts = 6400 *
parameters.getUntrackedParameter<
int>(
"tdcRescale", 1);
215 TH1F *TB =
new TH1F(histoName.c_str(),histoTitle.c_str(), maxTDCCounts/timeBoxGranularity, 0, maxTDCCounts);
219 TH1F *TB =
new TH1F(histoName.c_str(),histoTitle.c_str(), 2*tMax/timeBoxGranularity, tTrig-tMax, tTrig+2*tMax);
241 bool checkNoisyChannels =
parameters.getUntrackedParameter<
bool>(
"checkNoisyChannels",
false);
243 if(checkNoisyChannels) {
250 for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){
252 digiIt!=((*dtLayerId_It).second).
second; ++digiIt){
257 bool isSyncNoisy =
false;
258 if (tdcCount > maxTDCHits) isSyncNoisy =
true;
260 for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){
262 digiIt!=((*dtLayerId_It).second).
second; ++digiIt){
264 bool isNoisy =
false;
265 bool isFEMasked =
false;
266 bool isTDCMasked =
false;
267 bool isTrigMask =
false;
270 const DTWireId wireId(((*dtLayerId_It).first), (*digiIt).wire());
271 if(checkNoisyChannels) {
272 statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
285 float t0;
float t0RMS;
286 int tdcTime = (*digiIt).countsTDC();
288 if (
parameters.getParameter<
bool>(
"performPerWireT0Calibration")) {
289 const DTWireId dtWireId(((*dtLayerId_It).first), (*digiIt).wire());
291 tdcTime += int(round(t0));
295 if ((!isNoisy ) && (!isSyncNoisy)) {
297 if (TBMap.find(wireId) == TBMap.end()){
299 TBMap[wireId]->Fill(tdcTime);
302 TBMap[wireId]->Fill(tdcTime);
T getUntrackedParameter(std::string const &, T const &) const
virtual ~DTAlbertoBenvenutiTask()
Destructor.
DTChamberId chamberId() const
Return the corresponding ChamberId.
bool getByType(Handle< PROD > &result) const
void beginRun(const edm::Run &, const edm::EventSetup &)
int layer() const
Return the layer number.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
U second(std::pair< T, U > const &p)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
int superlayer() const
Return the superlayer number (deprecated method name)
std::vector< DigiType >::const_iterator const_iterator
DTLayerId layerId() const
Return the corresponding LayerId.
void bookHistos(const DTWireId dtWire)
Book the ME.
DTAlbertoBenvenutiTask(const edm::ParameterSet &ps)
Constructor.
int station() const
Return the station number.
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
int wheel() const
Return the wheel number.