CMS 3D CMS Logo

RPCEfficiencyFromTrack Class Reference

#include <DQM/RPCMonitorDigi/interface/RPCEfficiencyFromTrack.h>

Inheritance diagram for RPCEfficiencyFromTrack:

edm::EDAnalyzer

List of all members.

Public Types

typedef std::vector< TrajectoryTrajectories

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob (const edm::EventSetup &)
std::map< std::string,
MonitorElement * > 
bookDetUnitTrackEff (RPCDetId &detId, const edm::EventSetup &iSetup)
virtual void endJob ()
 RPCEfficiencyFromTrack (const edm::ParameterSet &)
 ~RPCEfficiencyFromTrack ()

Private Attributes

std::vector< std::string > _idList
time_t aTime
bool cosmic
std::vector< std::map
< RPCDetId, int > > 
counter
DQMStoredbe
std::string digiLabel
int DTTrigValue
ofstream * effres
std::string EffRootFileName
bool EffSaveRootFile
int EffSaveRootFileEventsInterval
TFile * fOutputFile
std::string GlobalRootLabel
edm::InputTag gmtSource_
TH1F * hGlobalPull
TH1F * hGlobalRes
TH1F * histoMean
TH1F * hRecPt
double maxRes
bool MeasureBarrel
bool MeasureEndCap
std::map< std::string,
std::map< std::string,
MonitorElement * > > 
meCollection
std::string RPCDataLabel
int Run
PropagatorthePropagator
std::string thePropagatorName
std::string TjInput
std::vector< inttotalcounter
int wh


Detailed Description

Definition at line 43 of file RPCEfficiencyFromTrack.h.


Member Typedef Documentation

typedef std::vector<Trajectory> RPCEfficiencyFromTrack::Trajectories

Definition at line 50 of file RPCEfficiencyFromTrack.h.


Constructor & Destructor Documentation

RPCEfficiencyFromTrack::RPCEfficiencyFromTrack ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 77 of file RPCEfficiencyFromTrack.cc.

References _idList, counter, dbe, digiLabel, DTTrigValue, effres, EffRootFileName, EffSaveRootFile, EffSaveRootFileEventsInterval, fOutputFile, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), GlobalRootLabel, gmtSource_, hGlobalPull, hGlobalRes, histoMean, maxRes, MeasureBarrel, MeasureEndCap, RPCDataLabel, thePropagator, thePropagatorName, TjInput, and totalcounter.

00077                                                                             {
00078 
00079   std::map<RPCDetId, int> buff;
00080   counter.clear();
00081   counter.reserve(3);
00082   counter.push_back(buff);
00083   counter.push_back(buff);
00084   counter.push_back(buff);
00085   totalcounter.clear();
00086   totalcounter.reserve(3);
00087   totalcounter[0]=0;
00088   totalcounter[1]=0;
00089   totalcounter[2]=0;
00090   
00091   MeasureEndCap = iConfig.getParameter<bool>("ReadEndCap");
00092   MeasureBarrel = iConfig.getParameter<bool>("ReadBarrel");
00093   maxRes = iConfig.getParameter<double>("EfficiencyCut");
00094   gmtSource_=iConfig.getParameter< InputTag >("gmtSource");
00095   EffSaveRootFile  = iConfig.getUntrackedParameter<bool>("EffSaveRootFile", true); 
00096   EffSaveRootFileEventsInterval  = iConfig.getUntrackedParameter<int>("EffEventsInterval", 1000); 
00097   DTTrigValue = iConfig.getUntrackedParameter<int>("dtTrigger",-10); 
00098 
00099   EffRootFileName  = iConfig.getUntrackedParameter<std::string>("EffRootFileName", "RPCEfficiencyFromTrack.root"); 
00100   TjInput  = iConfig.getUntrackedParameter<std::string>("trajectoryInput");
00101   RPCDataLabel = iConfig.getUntrackedParameter<std::string>("rpcRecHitLabel");
00102   digiLabel = iConfig.getUntrackedParameter<std::string>("rpcDigiLabel");
00103   thePropagatorName = iConfig.getParameter<std::string>("PropagatorName");
00104   thePropagator = 0;
00105 
00106   GlobalRootLabel= iConfig.getUntrackedParameter<std::string>("GlobalRootFileName","GlobalEfficiencyFromTrack.root");
00107   fOutputFile  = new TFile(GlobalRootLabel.c_str(), "RECREATE" );
00108 
00109   hGlobalRes = new TH1F("GlobalResiduals","GlobalRPCResiduals",50,-15.,15.);
00110   hGlobalPull = new TH1F("GlobalPull","GlobalRPCPull",50,-15.,15.);
00111   histoMean = new TH1F("MeanEfficincy","MeanEfficiency_vs_Ch",60,20.5,120.5);
00112 
00113 
00114   // get hold of back-end interface
00115   dbe = edm::Service<DQMStore>().operator->();
00116   _idList.clear(); 
00117   Run=0;
00118   effres = new ofstream("EfficiencyResults.dat");
00119 }

RPCEfficiencyFromTrack::~RPCEfficiencyFromTrack (  ) 

Definition at line 122 of file RPCEfficiencyFromTrack.cc.

References effres, fOutputFile, hGlobalPull, hGlobalRes, and histoMean.

00122                                                {
00123   effres->close();
00124   delete effres;
00125 
00126   fOutputFile->WriteTObject(hGlobalRes);
00127   fOutputFile->WriteTObject(hGlobalPull);
00128   fOutputFile->WriteTObject(histoMean);
00129 
00130 
00131   fOutputFile->Close();
00132 }


Member Function Documentation

void RPCEfficiencyFromTrack::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 136 of file RPCEfficiencyFromTrack.cc.

References _idList, anyDirection, aTime, bookDetUnitTrackEff(), counter, GenMuonPlsPt100GeV_cfg::cout, digiLabel, DTTrigValue, lat::endl(), edm::EventSetup::get(), edm::Event::getByLabel(), L1MuGMTReadoutCollection::getRecords(), gmtSource_, hGlobalPull, hGlobalRes, edm::Event::id(), RPCRoll::id(), reco::TransientTrack::impactPointTSCP(), TrajectoryStateOnSurface::isValid(), it, TrapezoidalStripTopology::localPosition(), TrajectoryStateOnSurface::localPosition(), RectangularStripTopology::localPosition(), maxRes, MeasureBarrel, MeasureEndCap, meCollection, RPCGeomServ::name(), reco::TransientTrack::numberOfValidHits(), edm::Handle< T >::product(), Propagator::propagate(), range, RPCDetId::region(), res, RPCChamber::rolls(), RPCDataLabel, edm::EventID::run(), Propagator::setPropagationDirection(), RPCRoll::strip(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), thePropagator, thePropagatorName, TrajectoryStateClosestToPoint::theState(), edm::Event::time(), TjInput, totalcounter, track, edm::Timestamp::value(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

00136                                                                                        {
00137   char layerLabel[128];
00138   char meIdRPC [128];
00139   char meIdTrack [128];
00140   std::map<RPCDetId, int> buff;
00141 
00142   edm::ESHandle<RPCGeometry> rpcGeo;
00143   iSetup.get<MuonGeometryRecord>().get(rpcGeo);
00144 
00145   edm::Handle<RPCRecHitCollection> rpcHits;
00146   iEvent.getByLabel(RPCDataLabel,rpcHits);
00147 
00148   edm::Handle<RPCDigiCollection> rpcDigis;
00149   iEvent.getByLabel(digiLabel, rpcDigis);
00150 
00151   ESHandle<MagneticField> theMGField;
00152   iSetup.get<IdealMagneticFieldRecord>().get(theMGField);
00153   
00154   ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
00155   iSetup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry);
00156 
00157 
00158   int nDTTF = 0;
00159   if(DTTrigValue!=-10){
00160     edm::Handle<std::vector<L1MuRegionalCand> > rpcBarrel;
00161     edm::Handle<std::vector<L1MuRegionalCand> > rpcForward;
00162     iEvent.getByLabel ("gtDigis","RPCb",rpcBarrel);
00163     iEvent.getByLabel ("gtDigis","RPCf",rpcForward);
00164     edm::Handle<L1MuGMTReadoutCollection> pCollection;
00165     try {
00166       iEvent.getByLabel(gmtSource_,pCollection);
00167     }
00168     catch (...) {
00169       return;
00170     }
00171 
00172     L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
00173     vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
00174     vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
00175 
00176     for(RRItr = gmt_records.begin(); RRItr != gmt_records.end(); RRItr++ ){    
00177       vector<L1MuRegionalCand> DTTFCands  = RRItr->getDTBXCands();
00178       vector<L1MuGMTExtendedCand>::const_iterator GMTItr;
00179       int BxInEvent = RRItr->getBxInEvent();
00180     
00181       if(BxInEvent!=0) continue;
00182       vector<L1MuRegionalCand>::const_iterator DTTFItr;
00183       for( DTTFItr = DTTFCands.begin(); DTTFItr != DTTFCands.end(); ++DTTFItr ) {
00184         if(!DTTFItr->empty()) nDTTF++;
00185       }
00186     }
00187   }
00188 
00189   Handle<reco::TrackCollection> staTracks;
00190   iEvent.getByLabel(TjInput, staTracks);
00191 
00192   reco::TrackCollection::const_iterator staTrack;
00193 
00194   std::cout<<"cacca"<<std::endl;
00195 
00196   ESHandle<Propagator> prop;
00197   iSetup.get<TrackingComponentsRecord>().get(thePropagatorName, prop);
00198   thePropagator = prop->clone();
00199   thePropagator->setPropagationDirection(anyDirection);
00200  
00201 
00202   std::map<RPCDetId,TrajectoryStateOnSurface> RPCstate;
00203 
00204 
00205   if(staTracks->size()!=0 && nDTTF>DTTrigValue){
00206     for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
00207       reco::TransientTrack track(*staTrack,&*theMGField,theTrackingGeometry);
00208  
00209       RPCstate.clear();
00210  
00211       if(track.numberOfValidHits()>24.){
00212         for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
00213           if( dynamic_cast< RPCChamber* >( *it ) != 0 ){
00214             RPCChamber* ch = dynamic_cast< RPCChamber* >( *it );
00215             std::vector< const RPCRoll*> rolhit = (ch->rolls());
00216 
00217             for(std::vector<const RPCRoll*>::const_iterator itRoll = rolhit.begin();itRoll != rolhit.end(); ++itRoll){
00218               RPCDetId rollId=(*itRoll)->id();
00219               const BoundPlane *rpcPlane =  &((*itRoll)->surface());
00220 
00221               //Barrel
00222               if(MeasureBarrel==true && rollId.region()==0){            
00223                 const RectangularStripTopology* top_= dynamic_cast<const RectangularStripTopology*> 
00224                   (&((*itRoll)->topology()));
00225                 LocalPoint xmin = top_->localPosition(0.);
00226                 LocalPoint xmax = top_->localPosition((float)(*itRoll)->nstrips());
00227                 float rsize = fabs( xmax.x()-xmin.x() )*0.5;
00228                 float stripl = top_->stripLength();
00229                 
00230                 TrajectoryStateClosestToPoint tcp = track.impactPointTSCP();
00231                 const FreeTrajectoryState &fTS=tcp.theState();
00232                 const FreeTrajectoryState *FreeState = &fTS;
00233                 TrajectoryStateOnSurface tsosAtRPC = thePropagator->propagate(*FreeState,*rpcPlane);
00234               
00235                 if(tsosAtRPC.isValid()
00236                    && fabs(tsosAtRPC.localPosition().z()) < 0.01 
00237                    && fabs(tsosAtRPC.localPosition().x()) < rsize 
00238                    && fabs(tsosAtRPC.localPosition().y()) < stripl*0.5){
00239                   //&& tsosAtRPC.localError().positionError().xx()<1.
00240                   //&& tsosAtRPC.localError().positionError().yy()<1.){
00241                   RPCstate[rollId]=tsosAtRPC;
00242                 }             
00243               }
00244 
00245               //EndCap
00246               if(MeasureEndCap==true && rollId.region()!=0){          
00247                 const TrapezoidalStripTopology* top_= dynamic_cast<const TrapezoidalStripTopology*> 
00248                   (&((*itRoll)->topology()));
00249                 LocalPoint xmin = top_->localPosition(0.);
00250                 LocalPoint xmax = top_->localPosition((float)(*itRoll)->nstrips());
00251                 float rsize = fabs( xmax.x()-xmin.x() )*0.5;
00252                 float stripl = top_->stripLength();
00253 
00254                 TrajectoryStateClosestToPoint tcp = track.impactPointTSCP();
00255                 const FreeTrajectoryState &fTS=tcp.theState();
00256                 const FreeTrajectoryState *FreeState = &fTS;
00257                 TrajectoryStateOnSurface tsosAtRPC = thePropagator->propagate(*FreeState,*rpcPlane);
00258               
00259                 if(tsosAtRPC.isValid()
00260                    && fabs(tsosAtRPC.localPosition().z()) < 0.01 
00261                    && fabs(tsosAtRPC.localPosition().x()) < rsize 
00262                    && fabs(tsosAtRPC.localPosition().y()) < stripl*0.5){
00263                   //&& tsosAtRPC.localError().positionError().xx()<1.
00264                   //&& tsosAtRPC.localError().positionError().yy()<1.){
00265                   RPCstate[rollId]=tsosAtRPC;
00266                 }             
00267               }
00268             }
00269           }
00270         }
00271       }
00272     
00273       //Efficiency      
00274       std::map<RPCDetId,TrajectoryStateOnSurface>::iterator irpc;
00275       for (irpc=RPCstate.begin(); irpc!=RPCstate.end();irpc++){
00276         RPCDetId rollId=irpc->first;
00277         const RPCRoll* rollasociated = rpcGeo->roll(rollId);
00278         TrajectoryStateOnSurface tsosAtRoll = RPCstate[rollId];
00279         
00280         const float stripPredicted =rollasociated->strip
00281           (LocalPoint(tsosAtRoll.localPosition().x(),tsosAtRoll.localPosition().y(),0.));
00282         const float xextrap = tsosAtRoll.localPosition().x();
00283         
00284         totalcounter[0]++;
00285         buff=counter[0];
00286         buff[rollId]++;
00287         counter[0]=buff;
00288 
00289 
00290         RPCGeomServ RPCname(rollId);
00291         std::string nameRoll = RPCname.name();
00292         
00293         _idList.push_back(nameRoll);
00294         char detUnitLabel[128];
00295         sprintf(detUnitLabel ,"%s",nameRoll.c_str());
00296         sprintf(layerLabel ,"%s",nameRoll.c_str());
00297         std::map<std::string, std::map<std::string,MonitorElement*> >::iterator meItr = meCollection.find(nameRoll);
00298         if (meItr == meCollection.end()){
00299           meCollection[nameRoll] = bookDetUnitTrackEff(rollId,iSetup);
00300         }
00301         std::map<std::string, MonitorElement*> meMap=meCollection[nameRoll];
00302         
00303         sprintf(meIdTrack,"ExpectedOccupancyFromTrack_%s",detUnitLabel);
00304         meMap[meIdTrack]->Fill(stripPredicted);
00305 
00306         Run=iEvent.id().run();
00307         aTime=iEvent.time().value();     
00308         
00309         RPCRecHitCollection::range rpcRecHitRange = rpcHits->get(rollasociated->id());
00310         RPCRecHitCollection::const_iterator recIt;        
00311         
00312         float res=0.;
00313         
00314         for (recIt = rpcRecHitRange.first; recIt!=rpcRecHitRange.second; ++recIt){
00315           LocalPoint rhitlocal = (*recIt).localPosition();
00316           double rhitpos = rhitlocal.x();  
00317           
00318           LocalError RecError = (*recIt).localPositionError();
00319           double sigmaRec = RecError.xx();
00320           res = (double)(xextrap - rhitpos);
00321           
00322           sprintf(meIdRPC,"ClusterSize_%s",detUnitLabel);
00323           meMap[meIdRPC]->Fill((*recIt).clusterSize());
00324           
00325           sprintf(meIdRPC,"BunchX_%s",detUnitLabel);
00326           meMap[meIdRPC]->Fill((*recIt).BunchX());       
00327           
00328           sprintf(meIdRPC,"Residuals_%s",detUnitLabel);
00329           meMap[meIdRPC]->Fill(res);
00330           
00331           hGlobalRes->Fill(res);
00332           hGlobalPull->Fill(res/sigmaRec);
00333         }
00334         
00335         int stripDetected=0;
00336         bool anycoincidence=false;
00337         
00338         RPCDigiCollection::Range rpcRangeDigi=rpcDigis->get(rollasociated->id());       
00339         for (RPCDigiCollection::const_iterator digiIt = rpcRangeDigi.first;digiIt!=rpcRangeDigi.second;++digiIt){
00340           stripDetected=digiIt->strip();
00341           res = (float)(stripDetected) - stripPredicted;
00342           if(fabs(res)<maxRes){
00343             anycoincidence=true;
00344             break;
00345           }
00346         }
00347         
00348         if(anycoincidence==true){
00349           
00350           std::cout<<"Good Match "<<"\t"<<"Residuals = "<<res<<"\t"<<nameRoll<<std::endl;
00351           
00352           totalcounter[1]++;
00353           buff=counter[1];
00354           buff[rollId]++;
00355           counter[1]=buff;
00356           
00357           sprintf(meIdRPC,"RPCDataOccupancy_%s",detUnitLabel);
00358           meMap[meIdRPC]->Fill(stripPredicted);
00359           
00360         }else if(anycoincidence==false){
00361           if(res==0){
00362             std::cout<<"No Fired "<<nameRoll<<std::endl;
00363           }
00364           if(res!=0){
00365             std::cout<<"No Match "<<"\t"<<"Residuals = "<<res<<"\t"<<nameRoll<<std::endl;
00366           }
00367 
00368           totalcounter[2]++;
00369           buff=counter[2];
00370           buff[rollId]++;
00371           counter[2]=buff;
00372         }
00373       }
00374     }
00375   }
00376 }

void RPCEfficiencyFromTrack::beginJob ( const edm::EventSetup  )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 381 of file RPCEfficiencyFromTrack.cc.

00381                                                          {
00382 
00383 }

std::map< std::string, MonitorElement * > RPCEfficiencyFromTrack::bookDetUnitTrackEff ( RPCDetId detId,
const edm::EventSetup iSetup 
)

Definition at line 25 of file RPCBookDetUnitTrackEff.cc.

References DQMStore::book1D(), GenMuonPlsPt100GeV_cfg::cout, dbe, lat::endl(), edm::EventSetup::get(), RPCGeomServ::name(), RPCRoll::nstrips(), RPCDetId::region(), RPCDetId::ring(), RPCDetId::sector(), DQMStore::setCurrentFolder(), and RPCDetId::station().

Referenced by analyze().

00025                                                                                                                              {
00026   
00027   std::map<std::string, MonitorElement*> meMap;
00028 
00029   char  folder[120];
00030   if(detId.region() ==  0)
00031   sprintf(folder,"RPC/EfficiencyFromTrack/Barrel/Wheel_%d/station_%d/sector_%d",
00032           detId.ring(),detId.station(),detId.sector());
00033   else if(detId.region() == -1) 
00034   sprintf(folder,"RPC/EfficiencyFromTrack/Endcap-/Disk_%d/station_%d/sector_%d",
00035           detId.station(),detId.ring(),detId.sector());
00036   else if(detId.region() ==  1) 
00037   sprintf(folder,"RPC/EfficiencyFromTrack/Endcap+/Disk_%d/station_%d/sector_%d",
00038           detId.station(),detId.ring(),detId.sector());
00039   else  std::cout <<"Region "<<detId.region()<< "not found!!! --- ERROR"<<std::endl;
00040 
00041   dbe->setCurrentFolder(folder);
00042 
00043 
00044   int strips = 0; double lastvalue = 0.;
00045 
00046   edm::ESHandle<RPCGeometry> rpcgeo;
00047   iSetup.get<MuonGeometryRecord>().get(rpcgeo);
00048 
00049   const RPCRoll * rpcRoll = rpcgeo->roll(detId);
00050   strips = rpcRoll->nstrips();
00051 
00052   if(strips == 0 ) strips = 1;
00053   lastvalue=(double)strips+0.5;
00054 
00055 
00056   RPCGeomServ RPCname(detId);
00057   std::string nameRoll = RPCname.name();
00058 
00059 
00060   char detUnitLabel[128];
00061   char layerLabel[128];
00062 
00063   sprintf(detUnitLabel ,"%s",nameRoll.c_str());
00064   sprintf(layerLabel ,"%s",nameRoll.c_str());
00065   
00066   char meId [128];
00067   char meTitle [128];
00068   
00069   //Begin booking
00070   sprintf(meId,"ExpectedOccupancyFromTrack_%s",detUnitLabel);
00071   sprintf(meTitle,"ExpectedOccupancyFromTrack_for_%s",layerLabel);
00072   meMap[meId] = dbe->book1D(meId, meTitle, strips, 0.5, lastvalue);
00073 
00074   sprintf(meId,"RPCDataOccupancy_%s",detUnitLabel);
00075   sprintf(meTitle,"RPCDataOccupancy_for_%s",layerLabel);
00076   meMap[meId] = dbe->book1D(meId, meTitle, strips, 0.5, lastvalue);
00077   
00078   sprintf(meId,"Residuals_%s",detUnitLabel);
00079   sprintf(meTitle,"Residuals_for_%s",layerLabel);
00080   meMap[meId] = dbe->book1D(meId, meTitle, 150,-49.5, 49.);
00081 
00082   sprintf(meId,"EfficienyFromTrackExtrapolation_%s",detUnitLabel);
00083   sprintf(meTitle,"EfficienyFromTrackExtrapolation_for_%s",layerLabel);
00084   meMap[meId] = dbe->book1D(meId, meTitle, strips, 0.5, lastvalue);
00085 
00086   sprintf(meId,"ClusterSize_%s",detUnitLabel);
00087   sprintf(meTitle,"ClusterSize_for_%s",layerLabel);
00088   meMap[meId] = dbe->book1D(meId, meTitle,10,0.5,10.5);
00089 
00090   sprintf(meId,"BunchX_%s",detUnitLabel);
00091   sprintf(meTitle,"BunchX_for_%s",layerLabel);
00092   meMap[meId] = dbe->book1D(meId, meTitle,13,-6.5,6.5);
00093 
00094   return meMap;
00095 }

void RPCEfficiencyFromTrack::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 385 of file RPCEfficiencyFromTrack.cc.

References _idList, aTime, counter, GenMuonPlsPt100GeV_cfg::cout, dbe, effres, EffRootFileName, EffSaveRootFile, lat::endl(), f, histoMean, i, meCollection, RPCGeomServ::name(), p, r, DQMStore::save(), funct::sqrt(), totalcounter, and muonGeometry::wheel.

00385                                    { 
00386   std::map<RPCDetId, int> pred = counter[0];
00387   std::map<RPCDetId, int> obse = counter[1];
00388   std::map<RPCDetId, int> reje = counter[2];
00389   std::map<RPCDetId, int>::iterator irpc;
00390   int f=0;
00391   for (irpc=pred.begin(); irpc!=pred.end();irpc++){
00392     RPCDetId id=irpc->first;
00393     RPCGeomServ RPCname(id);
00394     std::string nameRoll = RPCname.name();
00395     std::string wheel;
00396     std::string rpc;
00397     std::string partition;
00398 
00399     int p=pred[id]; 
00400     int o=obse[id]; 
00401     int r=reje[id]; 
00402     assert(p==o+r);
00403    
00404     if(p!=0){
00405       float ef = float(o)/float(p); 
00406       float er = sqrt(ef*(1.-ef)/float(p));
00407       if(ef>0.){
00408         *effres << nameRoll <<"\t Eff = "<<ef*100.<<" % +/- "<<er*100.<<" %"<<"\t Run= "<<Run<<"\t"<<ctime(&aTime)<<" ";
00409         histoMean->Fill(ef*100.);
00410       }
00411     }
00412     else{
00413       *effres <<"No predictions in this file predicted=0"<<std::endl;
00414     }
00415     f++;
00416   }
00417   if(totalcounter[0]!=0){
00418     float tote = float(totalcounter[1])/float(totalcounter[0]);
00419     float totr = sqrt(tote*(1.-tote)/float(totalcounter[0]));
00420     std::cout<<"Total Eff = "<<tote<<" +/- "<<totr<<std::endl;
00421   }
00422   else{
00423     std::cout<<"No predictions in this file = 0!!!"<<std::endl;
00424   }
00425 
00426   std::vector<std::string>::iterator meIt;
00427   int id=0;
00428   for(meIt = _idList.begin(); meIt != _idList.end(); ++meIt){
00429     id++;
00430     char detUnitLabel[128];
00431     char meIdRPC [128];
00432     char meIdTrack [128];
00433     char effIdRPC [128];
00434 
00435     sprintf(detUnitLabel ,"%s",(*meIt).c_str());
00436     sprintf(meIdRPC,"RPCDataOccupancy_%s",detUnitLabel);
00437     sprintf(meIdTrack,"ExpectedOccupancyFromTrack_%s",detUnitLabel);
00438     sprintf(effIdRPC,"EfficienyFromTrackExtrapolation_%s",detUnitLabel);
00439 
00440     std::map<std::string, MonitorElement*> meMap=meCollection[*meIt];
00441 
00442     for(unsigned int i=1;i<=100;++i){
00443       if(meMap[meIdTrack]->getBinContent(i) != 0){
00444         float eff = meMap[meIdRPC]->getBinContent(i)/meMap[meIdTrack]->getBinContent(i);
00445         float erreff = sqrt(eff*(1-eff)/meMap[meIdTrack]->getBinContent(i));
00446         meMap[effIdRPC]->setBinContent(i,eff*100.);
00447         meMap[effIdRPC]->setBinError(i,erreff*100.);
00448       }
00449     }
00450   } 
00451   if(EffSaveRootFile) dbe->save(EffRootFileName);
00452 }


Member Data Documentation

std::vector<std::string> RPCEfficiencyFromTrack::_idList [private]

Definition at line 85 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), endJob(), and RPCEfficiencyFromTrack().

time_t RPCEfficiencyFromTrack::aTime [private]

Definition at line 73 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), and endJob().

bool RPCEfficiencyFromTrack::cosmic [private]

Definition at line 70 of file RPCEfficiencyFromTrack.h.

std::vector<std::map<RPCDetId, int> > RPCEfficiencyFromTrack::counter [private]

Definition at line 86 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), endJob(), and RPCEfficiencyFromTrack().

DQMStore* RPCEfficiencyFromTrack::dbe [private]

Definition at line 89 of file RPCEfficiencyFromTrack.h.

Referenced by bookDetUnitTrackEff(), endJob(), and RPCEfficiencyFromTrack().

std::string RPCEfficiencyFromTrack::digiLabel [private]

Definition at line 77 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), and RPCEfficiencyFromTrack().

int RPCEfficiencyFromTrack::DTTrigValue [private]

Definition at line 66 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), and RPCEfficiencyFromTrack().

ofstream* RPCEfficiencyFromTrack::effres [private]

Definition at line 75 of file RPCEfficiencyFromTrack.h.

Referenced by endJob(), RPCEfficiencyFromTrack(), and ~RPCEfficiencyFromTrack().

std::string RPCEfficiencyFromTrack::EffRootFileName [private]

Definition at line 76 of file RPCEfficiencyFromTrack.h.

Referenced by endJob(), and RPCEfficiencyFromTrack().

bool RPCEfficiencyFromTrack::EffSaveRootFile [private]

Definition at line 64 of file RPCEfficiencyFromTrack.h.

Referenced by endJob(), and RPCEfficiencyFromTrack().

int RPCEfficiencyFromTrack::EffSaveRootFileEventsInterval [private]

Definition at line 65 of file RPCEfficiencyFromTrack.h.

Referenced by RPCEfficiencyFromTrack().

TFile* RPCEfficiencyFromTrack::fOutputFile [private]

Definition at line 56 of file RPCEfficiencyFromTrack.h.

Referenced by RPCEfficiencyFromTrack(), and ~RPCEfficiencyFromTrack().

std::string RPCEfficiencyFromTrack::GlobalRootLabel [private]

Definition at line 80 of file RPCEfficiencyFromTrack.h.

Referenced by RPCEfficiencyFromTrack().

edm::InputTag RPCEfficiencyFromTrack::gmtSource_ [private]

Definition at line 55 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), and RPCEfficiencyFromTrack().

TH1F* RPCEfficiencyFromTrack::hGlobalPull [private]

Definition at line 60 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), RPCEfficiencyFromTrack(), and ~RPCEfficiencyFromTrack().

TH1F* RPCEfficiencyFromTrack::hGlobalRes [private]

Definition at line 58 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), RPCEfficiencyFromTrack(), and ~RPCEfficiencyFromTrack().

TH1F* RPCEfficiencyFromTrack::histoMean [private]

Definition at line 59 of file RPCEfficiencyFromTrack.h.

Referenced by endJob(), RPCEfficiencyFromTrack(), and ~RPCEfficiencyFromTrack().

TH1F* RPCEfficiencyFromTrack::hRecPt [private]

Definition at line 57 of file RPCEfficiencyFromTrack.h.

double RPCEfficiencyFromTrack::maxRes [private]

Definition at line 61 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), and RPCEfficiencyFromTrack().

bool RPCEfficiencyFromTrack::MeasureBarrel [private]

Definition at line 63 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), and RPCEfficiencyFromTrack().

bool RPCEfficiencyFromTrack::MeasureEndCap [private]

Definition at line 62 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), and RPCEfficiencyFromTrack().

std::map<std::string, std::map<std::string, MonitorElement*> > RPCEfficiencyFromTrack::meCollection [private]

Definition at line 81 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), and endJob().

std::string RPCEfficiencyFromTrack::RPCDataLabel [private]

Definition at line 79 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), and RPCEfficiencyFromTrack().

int RPCEfficiencyFromTrack::Run [private]

Definition at line 72 of file RPCEfficiencyFromTrack.h.

Propagator* RPCEfficiencyFromTrack::thePropagator [mutable, private]

Definition at line 83 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), and RPCEfficiencyFromTrack().

std::string RPCEfficiencyFromTrack::thePropagatorName [private]

Definition at line 82 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), and RPCEfficiencyFromTrack().

std::string RPCEfficiencyFromTrack::TjInput [private]

Definition at line 78 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), and RPCEfficiencyFromTrack().

std::vector<int> RPCEfficiencyFromTrack::totalcounter [private]

Definition at line 87 of file RPCEfficiencyFromTrack.h.

Referenced by analyze(), endJob(), and RPCEfficiencyFromTrack().

int RPCEfficiencyFromTrack::wh [private]

Definition at line 69 of file RPCEfficiencyFromTrack.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:58 2009 for CMSSW by  doxygen 1.5.4