CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTPreCalibrationTask Class Reference

#include <DTPreCalibrationTask.h>

Inheritance diagram for DTPreCalibrationTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob ()
 BeginJob.
void bookOccupancyPlot (int wheel, int sector)
void bookTimeBoxes (int wheel, int sector)
 Book histos.
 DTPreCalibrationTask (const edm::ParameterSet &ps)
 Constructor.
void endJob ()
 EndJob.
virtual ~DTPreCalibrationTask ()
 Destructor.

Private Attributes

DQMStoredbe
std::string digiLabel
std::string folderName
int maxTriggerWidth
int minTriggerWidth
std::map< std::pair< int, int >
, MonitorElement * > 
OccupancyHistos
std::string outputFileName
bool saveFile
std::map< std::pair< int, int >
, MonitorElement * > 
TimeBoxes

Detailed Description

Analysis on DT digis (TB + occupancy) before the calibration step

Date:
2010/01/07 16:31:59
Revision:
1.4
Author:
G. Mila - INFN Torino

Definition at line 31 of file DTPreCalibrationTask.h.


Constructor & Destructor Documentation

DTPreCalibrationTask::DTPreCalibrationTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 36 of file DTPreCalibrationTask.cc.

References dtTPAnalyzer_cfg::digiLabel, edm::ParameterSet::getUntrackedParameter(), LogTrace, cppFunctionSkipper::operator, and dumpDBToFile_GT_ttrig_cfg::outputFileName.

                                                                   {

  LogTrace("DTPreCalibSummary") <<"[DTPrecalibrationTask]: Constructor"<<endl;

  dbe = Service<DQMStore>().operator->();

  // Label to retrieve DT digis from the event
  digiLabel = ps.getUntrackedParameter<string>("digiLabel"); 

  // parameter for Time Boxes booking
  minTriggerWidth = ps.getUntrackedParameter<int>("minTriggerWidth",2000); 
  maxTriggerWidth = ps.getUntrackedParameter<int>("maxTriggerWidth",6000); 

  // histo saving on file
  saveFile = ps.getUntrackedParameter<bool>("SaveFile",false); 
  // output file name
  outputFileName = ps.getUntrackedParameter<string>("outputFileName"); 
  // get the histo folder name
  folderName = ps.getUntrackedParameter<string>("folderName");

}
DTPreCalibrationTask::~DTPreCalibrationTask ( ) [virtual]

Destructor.

Definition at line 59 of file DTPreCalibrationTask.cc.

{}

Member Function Documentation

void DTPreCalibrationTask::analyze ( const edm::Event e,
const edm::EventSetup c 
) [virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 77 of file DTPreCalibrationTask.cc.

References dtTPAnalyzer_cfg::digiLabel, HcalObjRepresent::Fill(), DTLayerId::layer(), edm::second(), DTChamberId::station(), and DTSuperLayerId::superlayer().

                                                                                    {
  
  // Get the digis from the event
  edm::Handle<DTDigiCollection> dtdigis;
  event.getByLabel(digiLabel, dtdigis);

  // LOOP OVER ALL THE DIGIS OF THE EVENT
  DTDigiCollection::DigiRangeIterator dtLayerId_It;
  for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){
    for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first;
         digiIt!=((*dtLayerId_It).second).second; ++digiIt){

      //Fill the Time Boxes
      int tdcTime = (*digiIt).countsTDC();
      TimeBoxes[make_pair((*dtLayerId_It).first.superlayerId().chamberId().wheel(),
                          (*dtLayerId_It).first.superlayerId().chamberId().sector())]->Fill(tdcTime);

      //Fill the occupancy plot
      const  DTLayerId dtLId = (*dtLayerId_It).first;
      int yBin = (dtLId.station()-1)*12+dtLId.layer()+4*(dtLId.superlayer()-1);
      if(dtLId.station()==4 && dtLId.superlayer()==3)
        yBin = (dtLId.station()-1)*12+dtLId.layer()+4*(dtLId.superlayer()-2);
      if((*dtLayerId_It).first.superlayerId().chamberId().sector()<13)
        OccupancyHistos[make_pair((*dtLayerId_It).first.superlayerId().chamberId().wheel(),
                                  (*dtLayerId_It).first.superlayerId().chamberId().sector())]->Fill((*digiIt).wire(),yBin);
      else{
        if(dtLId.superlayer()!=3) yBin = 44 + dtLId.layer();
        else yBin = 48 + dtLId.layer();
        if((*dtLayerId_It).first.superlayerId().chamberId().sector()==13)
          OccupancyHistos[make_pair((*dtLayerId_It).first.superlayerId().chamberId().wheel(),4)]->Fill((*digiIt).wire(),yBin);
        if((*dtLayerId_It).first.superlayerId().chamberId().sector()==14)
          OccupancyHistos[make_pair((*dtLayerId_It).first.superlayerId().chamberId().wheel(),10)]->Fill((*digiIt).wire(),yBin);
      }
        
    }
  }

}
void DTPreCalibrationTask::beginJob ( void  ) [virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file DTPreCalibrationTask.cc.

References LogTrace.

                                   {
 
  for(int wheel=-2; wheel<=2; wheel++){
   for(int sector=1; sector<=14; sector++){
     LogTrace("DTPreCalibSummary") <<"[DTPrecalibrationTask]: Book histos for wheel "<<wheel<<", sector "<<sector<<endl;
     dbe->setCurrentFolder(folderName+"/TimeBoxes");  
     bookTimeBoxes(wheel, sector);
     dbe->setCurrentFolder(folderName+"/OccupancyHistos");
     if(sector<13) bookOccupancyPlot(wheel, sector);
    }
  }

}
void DTPreCalibrationTask::bookOccupancyPlot ( int  wheel,
int  sector 
)

Definition at line 139 of file DTPreCalibrationTask.cc.

                                                                  {

  stringstream wh; wh << wheel;
  stringstream sec; sec << sector;

  // book the occpancy plot
  if(sector==4 || sector==10)
    OccupancyHistos[make_pair(wheel, sector)]= dbe->book2D("Occupancy_W"+wh.str()+"_Sec"+sec.str(), "Occupancy W"+wh.str()+"_Sec"+sec.str(),100,1,100,52,1,53);
  else
    OccupancyHistos[make_pair(wheel, sector)]= dbe->book2D("Occupancy_W"+wh.str()+"_Sec"+sec.str(), "Occupancy W"+wh.str()+"_Sec"+sec.str(),100,1,100,44,1,45);
  OccupancyHistos[make_pair(wheel, sector)]->setAxisTitle("wire number", 1);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(1,"M1L1",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(2,"M1L2",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(3,"M1L3",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(4,"M1L4",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(5,"M1L5",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(6,"M1L6",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(7,"M1L7",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(8,"M1L8",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(9,"M1L9",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(10,"M1L10",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(11,"M1L11",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(12,"M1L12",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(13,"M2L1",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(14,"M2L2",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(15,"M2L3",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(16,"M2L4",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(17,"M2L5",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(18,"M2L6",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(19,"M2L7",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(20,"M2L8",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(21,"M2L9",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(22,"M2L10",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(23,"M2L11",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(24,"M2L12",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(25,"M3L1",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(26,"M3L2",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(27,"M3L3",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(28,"M3L4",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(29,"M3L5",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(30,"M3L6",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(31,"M3L7",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(32,"M3L8",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(33,"M3L9",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(34,"M3L10",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(35,"M3L11",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(36,"M3L12",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(37,"M4L1",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(38,"M4L2",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(39,"M4L3",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(40,"M4L4",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(41,"M4L5",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(42,"M4L6",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(43,"M4L7",2);
  OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(44,"M4L8",2);
  if(sector==4){
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(45,"M4Sec13L1",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(46,"M4Sec13L2",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(47,"M4Sec13L3",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(48,"M4Sec13L4",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(49,"M4Sec13L5",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(50,"M4Sec13L6",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(51,"M4Sec13L7",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(52,"M4Sec13L8",2);
  }
  if(sector==10){
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(45,"M4Sec14L1",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(46,"M4Sec14L2",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(47,"M4Sec14L3",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(48,"M4Sec14L4",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(49,"M4Sec14L5",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(50,"M4Sec14L6",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(51,"M4Sec14L7",2);
    OccupancyHistos[make_pair(wheel, sector)]->setBinLabel(52,"M4Sec14L8",2);
  }

}
void DTPreCalibrationTask::bookTimeBoxes ( int  wheel,
int  sector 
)

Book histos.

Definition at line 126 of file DTPreCalibrationTask.cc.

                                                              {

  stringstream wh; wh << wheel;
  stringstream sec; sec << sector;

  // book the time boxes
  TimeBoxes[make_pair(wheel, sector)]= dbe->book1D("TimeBox_W"+wh.str()+"_Sec"+sec.str(), "Time Box W"+wh.str()+"_Sec"+sec.str(),(maxTriggerWidth-minTriggerWidth)/50, minTriggerWidth, maxTriggerWidth);
  TimeBoxes[make_pair(wheel, sector)]->setAxisTitle("TDC counts");

}
void DTPreCalibrationTask::endJob ( void  ) [virtual]

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 117 of file DTPreCalibrationTask.cc.

References dumpDBToFile_GT_ttrig_cfg::outputFileName.

                                 {
  
  // save file for offLine analysis
  if(saveFile)
    dbe->save(outputFileName);

}

Member Data Documentation

Definition at line 56 of file DTPreCalibrationTask.h.

std::string DTPreCalibrationTask::digiLabel [private]

Definition at line 57 of file DTPreCalibrationTask.h.

std::string DTPreCalibrationTask::folderName [private]

Definition at line 62 of file DTPreCalibrationTask.h.

Definition at line 59 of file DTPreCalibrationTask.h.

Definition at line 58 of file DTPreCalibrationTask.h.

std::map<std::pair<int,int>, MonitorElement* > DTPreCalibrationTask::OccupancyHistos [private]

Definition at line 68 of file DTPreCalibrationTask.h.

std::string DTPreCalibrationTask::outputFileName [private]

Definition at line 61 of file DTPreCalibrationTask.h.

Definition at line 60 of file DTPreCalibrationTask.h.

std::map<std::pair<int,int>, MonitorElement* > DTPreCalibrationTask::TimeBoxes [private]

Definition at line 65 of file DTPreCalibrationTask.h.