#include <DQMOffline/Muon/interface/RPCEfficiency.h>
Definition at line 104 of file RPCEfficiency.h.
RPCEfficiency::RPCEfficiency | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 47 of file RPCEfficiency.cc.
References AngClu1La1, AngClu1La2, AngClu1La3, AngClu1La4, AngClu1La5, AngClu1La6, AngClu2La1, AngClu2La2, AngClu2La3, AngClu2La4, AngClu2La5, AngClu2La6, AngClu3La1, AngClu3La2, AngClu3La3, AngClu3La4, AngClu3La5, AngClu3La6, GenMuonPlsPt100GeV_cfg::cout, cscSegments, dbe, debug, DistBorderClu1La1, DistBorderClu1La2, DistBorderClu1La3, DistBorderClu1La4, DistBorderClu1La5, DistBorderClu1La6, DistBorderClu2La1, DistBorderClu2La2, DistBorderClu2La3, DistBorderClu2La4, DistBorderClu2La5, DistBorderClu2La6, DistBorderClu3La1, DistBorderClu3La2, DistBorderClu3La3, DistBorderClu3La4, DistBorderClu3La5, DistBorderClu3La6, dt4DSegments, dupli, EffRootFileName, EffSaveRootFile, lat::endl(), edm::ParameterSet::getUntrackedParameter(), hGlobalResClu1La1, hGlobalResClu1La2, hGlobalResClu1La3, hGlobalResClu1La4, hGlobalResClu1La5, hGlobalResClu1La6, hGlobalResClu1R2A, hGlobalResClu1R2B, hGlobalResClu1R2C, hGlobalResClu1R3A, hGlobalResClu1R3B, hGlobalResClu1R3C, hGlobalResClu2La1, hGlobalResClu2La2, hGlobalResClu2La3, hGlobalResClu2La4, hGlobalResClu2La5, hGlobalResClu2La6, hGlobalResClu2R2A, hGlobalResClu2R2B, hGlobalResClu2R2C, hGlobalResClu2R3A, hGlobalResClu2R3B, hGlobalResClu2R3C, hGlobalResClu3La1, hGlobalResClu3La2, hGlobalResClu3La3, hGlobalResClu3La4, hGlobalResClu3La5, hGlobalResClu3La6, hGlobalResClu3R2A, hGlobalResClu3R2B, hGlobalResClu3R2C, hGlobalResClu3R3A, hGlobalResClu3R3B, hGlobalResClu3R3C, inclcsc, incldt, incldtMB4, inves, MaxD, MaxDrb4, MinCosAng, muonRPCDigis, nameInLog, ofrej, pi, rangestrips, rangestripsRB4, MonitorElement::setBinLabel(), and statistics.
00047 { 00048 incldt=iConfig.getUntrackedParameter<bool>("incldt",true); 00049 incldtMB4=iConfig.getUntrackedParameter<bool>("incldtMB4",true); 00050 inclcsc=iConfig.getUntrackedParameter<bool>("inclcsc",true); 00051 debug=iConfig.getUntrackedParameter<bool>("debug",false); 00052 inves=iConfig.getUntrackedParameter<bool>("inves"); 00053 00054 rangestrips = iConfig.getUntrackedParameter<double>("rangestrips",1.); 00055 rangestripsRB4=iConfig.getUntrackedParameter<double>("rangestripsRB4",4.); 00056 dupli = iConfig.getUntrackedParameter<int>("DuplicationCorrection",2); 00057 MinCosAng=iConfig.getUntrackedParameter<double>("MinCosAng",0.9999); 00058 MaxD=iConfig.getUntrackedParameter<double>("MaxD",20.); 00059 MaxDrb4=iConfig.getUntrackedParameter<double>("MaxDrb4",30.); 00060 muonRPCDigis=iConfig.getUntrackedParameter<std::string>("muonRPCDigis","muonRPCDigis"); 00061 cscSegments=iConfig.getUntrackedParameter<std::string>("cscSegments","cscSegments"); 00062 dt4DSegments=iConfig.getUntrackedParameter<std::string>("dt4DSegments","dt4DSegments"); 00063 00064 nameInLog = iConfig.getUntrackedParameter<std::string>("moduleLogName", "RPC_Eff"); 00065 EffSaveRootFile = iConfig.getUntrackedParameter<bool>("EffSaveRootFile", false); 00066 EffRootFileName = iConfig.getUntrackedParameter<std::string>("EffRootFileName", "RPCEfficiency.root"); 00067 00068 //Interface 00069 00070 dbe = edm::Service<DQMStore>().operator->(); 00071 00072 std::string folder = "Muons/MuonSegEff/"; 00073 dbe->setCurrentFolder(folder); 00074 statistics = dbe->book1D("Statistics","All Statistics",33,0.5,33.5); 00075 00076 if(debug) std::cout<<"booking Global histograms"<<std::endl; 00077 00078 statistics->setBinLabel(1,"Events ",1); 00079 statistics->setBinLabel(2,"Events with DT segments",1); 00080 statistics->setBinLabel(3,"Events with 1 DT segment",1); 00081 statistics->setBinLabel(4,"Events with 2 DT segments",1); 00082 statistics->setBinLabel(5,"Events with 3 DT segments",1); 00083 statistics->setBinLabel(6,"Events with 4 DT segments",1); 00084 statistics->setBinLabel(7,"Events with 5 DT segments",1); 00085 statistics->setBinLabel(8,"Events with 6 DT segments",1); 00086 statistics->setBinLabel(9,"Events with 7 DT segments",1); 00087 statistics->setBinLabel(10,"Events with 8 DT segments",1); 00088 statistics->setBinLabel(11,"Events with 9 DT segments",1); 00089 statistics->setBinLabel(12,"Events with 10 DT segments",1); 00090 statistics->setBinLabel(13,"Events with 11 DT segments",1); 00091 statistics->setBinLabel(14,"Events with 12 DT segments",1); 00092 statistics->setBinLabel(15,"Events with 13 DT segments",1); 00093 statistics->setBinLabel(16,"Events with 14 DT segments",1); 00094 statistics->setBinLabel(17,"Events with 15 DT segments",1); 00095 statistics->setBinLabel(18,"Events with CSC segments",1); 00096 statistics->setBinLabel(16+3,"Events with 1 CSC segment",1); 00097 statistics->setBinLabel(16+4,"Events with 2 CSC segments",1); 00098 statistics->setBinLabel(16+5,"Events with 3 CSC segments",1); 00099 statistics->setBinLabel(16+6,"Events with 4 CSC segments",1); 00100 statistics->setBinLabel(16+7,"Events with 5 CSC segments",1); 00101 statistics->setBinLabel(16+8,"Events with 6 CSC segments",1); 00102 statistics->setBinLabel(16+9,"Events with 7 CSC segments",1); 00103 statistics->setBinLabel(16+10,"Events with 8 CSC segments",1); 00104 statistics->setBinLabel(16+11,"Events with 9 CSC segments",1); 00105 statistics->setBinLabel(16+12,"Events with 10 CSC segments",1); 00106 statistics->setBinLabel(16+13,"Events with 11 CSC segments",1); 00107 statistics->setBinLabel(16+14,"Events with 12 CSC segments",1); 00108 statistics->setBinLabel(16+15,"Events with 13 CSC segments",1); 00109 statistics->setBinLabel(16+16,"Events with 14 CSC segments",1); 00110 statistics->setBinLabel(16+17,"Events with 15 CSC segments",1); 00111 00112 if(debug) std::cout<<"booking Global histograms Change statistics"<<std::endl; 00113 00114 folder = "Muons/MuonSegEff/Residuals/Investigation"; 00115 dbe->setCurrentFolder(folder); 00116 00117 //Paper TH1Fs 00118 00119 DistBorderClu1La1 = dbe->book1D("DistBorderClu1La1","Distance to the Border of the Strip Layer 1 Cluster Size 1",50,-2.,3.); 00120 DistBorderClu1La2 = dbe->book1D("DistBorderClu1La2","Distance to the Border of the Strip Layer 2 Cluster Size 1",50,-2.,3.); 00121 DistBorderClu1La3 = dbe->book1D("DistBorderClu1La3","Distance to the Border of the Strip Layer 3 Cluster Size 1",50,-2.,3.); 00122 DistBorderClu1La4 = dbe->book1D("DistBorderClu1La4","Distance to the Border of the Strip Layer 4 Cluster Size 1",50,-2.,3.); 00123 DistBorderClu1La5 = dbe->book1D("DistBorderClu1La5","Distance to the Border of the Strip Layer 5 Cluster Size 1",50,-2.,3.); 00124 DistBorderClu1La6 = dbe->book1D("DistBorderClu1La6","Distance to the Border of the Strip Layer 6 Cluster Size 1",50,-2.,3.); 00125 00126 DistBorderClu2La1 = dbe->book1D("DistBorderClu2La1","Distance to the Border of the Strip Layer 1 Cluster Size 2",50,-2.,3.); 00127 DistBorderClu2La2 = dbe->book1D("DistBorderClu2La2","Distance to the Border of the Strip Layer 2 Cluster Size 2",50,-2.,3.); 00128 DistBorderClu2La3 = dbe->book1D("DistBorderClu2La3","Distance to the Border of the Strip Layer 3 Cluster Size 2",50,-2.,3.); 00129 DistBorderClu2La4 = dbe->book1D("DistBorderClu2La4","Distance to the Border of the Strip Layer 4 Cluster Size 2",50,-2.,3.); 00130 DistBorderClu2La5 = dbe->book1D("DistBorderClu2La5","Distance to the Border of the Strip Layer 5 Cluster Size 2",50,-2.,3.); 00131 DistBorderClu2La6 = dbe->book1D("DistBorderClu2La6","Distance to the Border of the Strip Layer 6 Cluster Size 2",50,-2.,3.); 00132 00133 DistBorderClu3La1 = dbe->book1D("DistBorderClu3La1","Distance to the Border of the Strip Layer 1 Cluster Size 3",50,-2.,3.); 00134 DistBorderClu3La2 = dbe->book1D("DistBorderClu3La2","Distance to the Border of the Strip Layer 2 Cluster Size 3",50,-2.,3.); 00135 DistBorderClu3La3 = dbe->book1D("DistBorderClu3La3","Distance to the Border of the Strip Layer 3 Cluster Size 3",50,-2.,3.); 00136 DistBorderClu3La4 = dbe->book1D("DistBorderClu3La4","Distance to the Border of the Strip Layer 4 Cluster Size 3",50,-2.,3.); 00137 DistBorderClu3La5 = dbe->book1D("DistBorderClu3La5","Distance to the Border of the Strip Layer 5 Cluster Size 3",50,-2.,3.); 00138 DistBorderClu3La6 = dbe->book1D("DistBorderClu3La6","Distance to the Border of the Strip Layer 6 Cluster Size 3",50,-2.,3.); 00139 00140 //Ang Dependence 00141 float pi = 3.14159265; 00142 AngClu1La1 = dbe->book1D("AngClu1La1","Angle of incident Muon Layer 1 Cluster Size 1",50,0.,pi); 00143 AngClu1La2 = dbe->book1D("AngClu1La2","Angle of incident Muon Layer 2 Cluster Size 1",50,0.,pi); 00144 AngClu1La3 = dbe->book1D("AngClu1La3","Angle of incident Muon Layer 3 Cluster Size 1",50,0.,pi); 00145 AngClu1La4 = dbe->book1D("AngClu1La4","Angle of incident Muon Layer 4 Cluster Size 1",50,0.,pi); 00146 AngClu1La5 = dbe->book1D("AngClu1La5","Angle of incident Muon Layer 5 Cluster Size 1",50,0.,pi); 00147 AngClu1La6 = dbe->book1D("AngClu1La6","Angle of incident Muon Layer 6 Cluster Size 1",50,0.,pi); 00148 00149 AngClu2La1 = dbe->book1D("AngClu2La1","Angle of incident Muon Layer 1 Cluster Size 2",50,0.,pi); 00150 AngClu2La2 = dbe->book1D("AngClu2La2","Angle of incident Muon Layer 2 Cluster Size 2",50,0.,pi); 00151 AngClu2La3 = dbe->book1D("AngClu2La3","Angle of incident Muon Layer 3 Cluster Size 2",50,0.,pi); 00152 AngClu2La4 = dbe->book1D("AngClu2La4","Angle of incident Muon Layer 4 Cluster Size 2",50,0.,pi); 00153 AngClu2La5 = dbe->book1D("AngClu2La5","Angle of incident Muon Layer 5 Cluster Size 2",50,0.,pi); 00154 AngClu2La6 = dbe->book1D("AngClu2La6","Angle of incident Muon Layer 6 Cluster Size 2",50,0.,pi); 00155 00156 AngClu3La1 = dbe->book1D("AngClu3La1","Angle of incident Muon Layer 1 Cluster Size 3",50,0.,pi); 00157 AngClu3La2 = dbe->book1D("AngClu3La2","Angle of incident Muon Layer 2 Cluster Size 3",50,0.,pi); 00158 AngClu3La3 = dbe->book1D("AngClu3La3","Angle of incident Muon Layer 3 Cluster Size 3",50,0.,pi); 00159 AngClu3La4 = dbe->book1D("AngClu3La4","Angle of incident Muon Layer 4 Cluster Size 3",50,0.,pi); 00160 AngClu3La5 = dbe->book1D("AngClu3La5","Angle of incident Muon Layer 5 Cluster Size 3",50,0.,pi); 00161 AngClu3La6 = dbe->book1D("AngClu3La6","Angle of incident Muon Layer 6 Cluster Size 3",50,0.,pi); 00162 00163 folder = "Muons/MuonSegEff/Residuals/Barrel"; 00164 dbe->setCurrentFolder(folder); 00165 00166 //Barrel 00167 hGlobalResClu1La1 = dbe->book1D("GlobalResidualsClu1La1","RPC Residuals Layer 1 Cluster Size 1",101,-10.,10.); 00168 hGlobalResClu1La2 = dbe->book1D("GlobalResidualsClu1La2","RPC Residuals Layer 2 Cluster Size 1",101,-10.,10.); 00169 hGlobalResClu1La3 = dbe->book1D("GlobalResidualsClu1La3","RPC Residuals Layer 3 Cluster Size 1",101,-10.,10.); 00170 hGlobalResClu1La4 = dbe->book1D("GlobalResidualsClu1La4","RPC Residuals Layer 4 Cluster Size 1",101,-10.,10.); 00171 hGlobalResClu1La5 = dbe->book1D("GlobalResidualsClu1La5","RPC Residuals Layer 5 Cluster Size 1",101,-10.,10.); 00172 hGlobalResClu1La6 = dbe->book1D("GlobalResidualsClu1La6","RPC Residuals Layer 6 Cluster Size 1",101,-10.,10.); 00173 00174 hGlobalResClu2La1 = dbe->book1D("GlobalResidualsClu2La1","RPC Residuals Layer 1 Cluster Size 2",101,-10.,10.); 00175 hGlobalResClu2La2 = dbe->book1D("GlobalResidualsClu2La2","RPC Residuals Layer 2 Cluster Size 2",101,-10.,10.); 00176 hGlobalResClu2La3 = dbe->book1D("GlobalResidualsClu2La3","RPC Residuals Layer 3 Cluster Size 2",101,-10.,10.); 00177 hGlobalResClu2La4 = dbe->book1D("GlobalResidualsClu2La4","RPC Residuals Layer 4 Cluster Size 2",101,-10.,10.); 00178 hGlobalResClu2La5 = dbe->book1D("GlobalResidualsClu2La5","RPC Residuals Layer 5 Cluster Size 2",101,-10.,10.); 00179 hGlobalResClu2La6 = dbe->book1D("GlobalResidualsClu2La6","RPC Residuals Layer 6 Cluster Size 2",101,-10.,10.); 00180 00181 hGlobalResClu3La1 = dbe->book1D("GlobalResidualsClu3La1","RPC Residuals Layer 1 Cluster Size 3",101,-10.,10.); 00182 hGlobalResClu3La2 = dbe->book1D("GlobalResidualsClu3La2","RPC Residuals Layer 2 Cluster Size 3",101,-10.,10.); 00183 hGlobalResClu3La3 = dbe->book1D("GlobalResidualsClu3La3","RPC Residuals Layer 3 Cluster Size 3",101,-10.,10.); 00184 hGlobalResClu3La4 = dbe->book1D("GlobalResidualsClu3La4","RPC Residuals Layer 4 Cluster Size 3",101,-10.,10.); 00185 hGlobalResClu3La5 = dbe->book1D("GlobalResidualsClu3La5","RPC Residuals Layer 5 Cluster Size 3",101,-10.,10.); 00186 hGlobalResClu3La6 = dbe->book1D("GlobalResidualsClu3La6","RPC Residuals Layer 6 Cluster Size 3",101,-10.,10.); 00187 00188 if(debug) std::cout<<"Booking Residuals for EndCap"<<std::endl; 00189 folder = "Muons/MuonSegEff/Residuals/EndCap"; 00190 dbe->setCurrentFolder(folder); 00191 00192 //Endcap 00193 hGlobalResClu1R3C = dbe->book1D("GlobalResidualsClu1R3C","RPC Residuals Ring 3 Roll C Cluster Size 1",101,-10.,10.); 00194 hGlobalResClu1R3B = dbe->book1D("GlobalResidualsClu1R3B","RPC Residuals Ring 3 Roll B Cluster Size 1",101,-10.,10.); 00195 hGlobalResClu1R3A = dbe->book1D("GlobalResidualsClu1R3A","RPC Residuals Ring 3 Roll A Cluster Size 1",101,-10.,10.); 00196 hGlobalResClu1R2C = dbe->book1D("GlobalResidualsClu1R2C","RPC Residuals Ring 2 Roll C Cluster Size 1",101,-10.,10.); 00197 hGlobalResClu1R2B = dbe->book1D("GlobalResidualsClu1R2B","RPC Residuals Ring 2 Roll B Cluster Size 1",101,-10.,10.); 00198 hGlobalResClu1R2A = dbe->book1D("GlobalResidualsClu1R2A","RPC Residuals Ring 2 Roll A Cluster Size 1",101,-10.,10.); 00199 00200 hGlobalResClu2R3C = dbe->book1D("GlobalResidualsClu2R3C","RPC Residuals Ring 3 Roll C Cluster Size 2",101,-10.,10.); 00201 hGlobalResClu2R3B = dbe->book1D("GlobalResidualsClu2R3B","RPC Residuals Ring 3 Roll B Cluster Size 2",101,-10.,10.); 00202 hGlobalResClu2R3A = dbe->book1D("GlobalResidualsClu2R3A","RPC Residuals Ring 3 Roll A Cluster Size 2",101,-10.,10.); 00203 hGlobalResClu2R2C = dbe->book1D("GlobalResidualsClu2R2C","RPC Residuals Ring 2 Roll C Cluster Size 2",101,-10.,10.); 00204 hGlobalResClu2R2B = dbe->book1D("GlobalResidualsClu2R2B","RPC Residuals Ring 2 Roll B Cluster Size 2",101,-10.,10.); 00205 hGlobalResClu2R2A = dbe->book1D("GlobalResidualsClu2R2A","RPC Residuals Ring 2 Roll A Cluster Size 2",101,-10.,10.); 00206 00207 hGlobalResClu3R3C = dbe->book1D("GlobalResidualsClu3R3C","RPC Residuals Ring 3 Roll C Cluster Size 3",101,-10.,10.); 00208 hGlobalResClu3R3B = dbe->book1D("GlobalResidualsClu3R3B","RPC Residuals Ring 3 Roll B Cluster Size 3",101,-10.,10.); 00209 hGlobalResClu3R3A = dbe->book1D("GlobalResidualsClu3R3A","RPC Residuals Ring 3 Roll A Cluster Size 3",101,-10.,10.); 00210 hGlobalResClu3R2C = dbe->book1D("GlobalResidualsClu3R2C","RPC Residuals Ring 2 Roll C Cluster Size 3",101,-10.,10.); 00211 hGlobalResClu3R2B = dbe->book1D("GlobalResidualsClu3R2B","RPC Residuals Ring 2 Roll B Cluster Size 3",101,-10.,10.); 00212 hGlobalResClu3R2A = dbe->book1D("GlobalResidualsClu3R2A","RPC Residuals Ring 2 Roll A Cluster Size 3",101,-10.,10.); 00213 00214 00215 if(debug) ofrej.open("rejected.txt"); 00216 00217 if(debug) std::cout<<"Rejected done"<<std::endl; 00218 00219 }
RPCEfficiency::~RPCEfficiency | ( | ) |
void RPCEfficiency::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 366 of file RPCEfficiency.cc.
References funct::abs(), AngClu1La1, AngClu1La2, AngClu1La3, AngClu1La4, AngClu1La5, AngClu1La6, AngClu2La1, AngClu2La2, AngClu2La3, AngClu2La4, AngClu2La5, AngClu2La6, AngClu3La1, AngClu3La2, AngClu3La3, AngClu3La4, AngClu3La5, AngClu3La6, PV3DBase< T, PVType, FrameType >::barePhi(), CSCDetId::chamber(), GenMuonPlsPt100GeV_cfg::cout, cscGeo, cscSegments, funct::D, debug, DistBorderClu1La1, DistBorderClu1La2, DistBorderClu1La3, DistBorderClu1La4, DistBorderClu1La5, DistBorderClu1La6, DistBorderClu2La1, DistBorderClu2La2, DistBorderClu2La3, DistBorderClu2La4, DistBorderClu2La5, DistBorderClu3La1, DistBorderClu3La2, DistBorderClu3La3, DistBorderClu3La4, DistBorderClu3La5, dt4DSegments, dtGeo, dupli, CSCDetId::endcap(), lat::endl(), MonitorElement::Fill(), edm::Event::getByLabel(), edm::Event::getByType(), hGlobalResClu1La1, hGlobalResClu1La2, hGlobalResClu1La3, hGlobalResClu1La4, hGlobalResClu1La5, hGlobalResClu1La6, hGlobalResClu1R2A, hGlobalResClu1R2B, hGlobalResClu1R2C, hGlobalResClu1R3A, hGlobalResClu1R3B, hGlobalResClu1R3C, hGlobalResClu2La1, hGlobalResClu2La2, hGlobalResClu2La3, hGlobalResClu2La4, hGlobalResClu2La5, hGlobalResClu2La6, hGlobalResClu2R2A, hGlobalResClu2R2B, hGlobalResClu2R2C, hGlobalResClu2R3A, hGlobalResClu2R3B, hGlobalResClu2R3C, hGlobalResClu3La1, hGlobalResClu3La2, hGlobalResClu3La3, hGlobalResClu3La4, hGlobalResClu3La5, hGlobalResClu3La6, hGlobalResClu3R2A, hGlobalResClu3R2B, hGlobalResClu3R2C, hGlobalResClu3R3A, hGlobalResClu3R3B, hGlobalResClu3R3C, CSCChamber::id(), edm::Event::id(), RPCRoll::id(), inclcsc, incldt, incldtMB4, inves, it, RPCDetId::layer(), TrapezoidalStripTopology::localPosition(), RectangularStripTopology::localPosition(), MaxD, MaxDrb4, meCollection, MinCosAng, muonRPCDigis, mySegment(), RPCGeomServ::name(), RPCRoll::nstrips(), ofrej, PV3DBase< T, PVType, FrameType >::perp(), RectangularStripTopology::pitch(), TrapezoidalStripTopology::pitch(), r, rangestrips, RPCDetId::region(), res, RPCDetId::ring(), CSCDetId::ring(), RPCDetId::roll(), RPCChamber::rolls(), rollstoreCSC, rollstoreDT, rpcGeo, DTChamberId::sector(), funct::sqrt(), RPCDetId::station(), CSCDetId::station(), DTChamberId::station(), statistics, RPCRoll::strip(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), GeomDet::surface(), Surface::toGlobal(), GeomDet::toGlobal(), GloballyPositioned< T >::toLocal(), GeomDet::toLocal(), RPCRoll::topology(), DTChamberId::wheel(), PV3DBase< T, PVType, FrameType >::x(), X, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
00367 { 00368 00369 statistics->Fill(1); 00370 using namespace edm; 00371 00372 char layerLabel[128]; 00373 char meIdRPC [128]; 00374 char meIdDT [128]; 00375 char meIdCSC [128]; 00376 00377 //-------------Filling Other Histograms for correlations ----------- 00378 00379 if(debug) std::cout <<"Digi Getting the RPC Digis"<<std::endl; 00380 edm::Handle<RPCDigiCollection> rpcDigis; 00381 iEvent.getByLabel(muonRPCDigis, rpcDigis); 00382 char detUnitLabel[128]; 00383 for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){ 00384 if(dynamic_cast< RPCChamber* >( *it ) != 0 ){ 00385 RPCChamber* ch = dynamic_cast< RPCChamber* >( *it ); 00386 std::vector< const RPCRoll*> roles = (ch->rolls()); 00387 for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){ 00388 RPCDetId rpcId = (*r)->id(); 00389 RPCGeomServ rpcsrv(rpcId); 00390 std::string nameRoll = rpcsrv.name(); 00391 std::map<std::string, MonitorElement*> meMap=meCollection[nameRoll]; 00392 sprintf(detUnitLabel ,"%s",nameRoll.c_str()); 00393 00394 sprintf(layerLabel ,"%s",nameRoll.c_str()); 00395 RPCDigiCollection::Range rpcRangeDigi=rpcDigis->get(rpcId); 00396 for (RPCDigiCollection::const_iterator digiIt = rpcRangeDigi.first;digiIt!=rpcRangeDigi.second;++digiIt){ 00397 int stripDetected=digiIt->strip(); 00398 sprintf(meIdRPC,"BXDistribution_%s",detUnitLabel); 00399 meMap[meIdRPC]->Fill(digiIt->bx()); 00400 if(rpcId.region()==0){ 00401 sprintf(meIdRPC,"RealDetectedOccupancyFromDT_%s",detUnitLabel); 00402 }else { 00403 sprintf(meIdRPC,"RealDetectedOccupancyFromCSC_%s",detUnitLabel); 00404 } 00405 meMap[meIdRPC]->Fill(stripDetected); //have a look to this! 00406 00407 } 00408 } 00409 } 00410 } 00411 00412 //------------------------------------------------------------------------------------ 00413 00414 if(debug) std::cout <<"\t Getting the RPC RecHits"<<std::endl; 00415 Handle<RPCRecHitCollection> rpcHits; 00416 iEvent.getByType(rpcHits); 00417 00418 if(incldt){ 00419 if(debug) std::cout<<"\t Getting the DT Segments"<<std::endl; 00420 edm::Handle<DTRecSegment4DCollection> all4DSegments; 00421 iEvent.getByLabel(dt4DSegments, all4DSegments); 00422 if(all4DSegments->size()>0){ 00423 if(all4DSegments->size()<=16) statistics->Fill(2); 00424 00425 if(debug) std::cout<<"\t Number of DT Segments in this event = "<<all4DSegments->size()<<std::endl; 00426 00427 std::map<DTChamberId,int> DTSegmentCounter; 00428 DTRecSegment4DCollection::const_iterator segment; 00429 00430 for (segment = all4DSegments->begin();segment!=all4DSegments->end(); ++segment){ 00431 DTSegmentCounter[segment->chamberId()]++; 00432 } 00433 00434 statistics->Fill(all4DSegments->size()+2); 00435 00436 if(debug) std::cout<<"\t Loop over all the 4D Segments"<<std::endl; 00437 for (segment = all4DSegments->begin(); segment != all4DSegments->end(); ++segment){ 00438 00439 DTChamberId DTId = segment->chamberId(); 00440 00441 00442 if(debug) std::cout<<"DT \t \t This Segment is in Chamber id: "<<DTId<<std::endl; 00443 if(debug) std::cout<<"DT \t \t Number of segments in this DT = "<<DTSegmentCounter[DTId]<<std::endl; 00444 if(debug) std::cout<<"DT \t \t Is the only one in this DT? and is not in the 4th Station?"<<std::endl; 00445 00446 00447 if(DTSegmentCounter[DTId]==1 && DTId.station()!=4){ 00448 00449 int dtWheel = DTId.wheel(); 00450 int dtStation = DTId.station(); 00451 int dtSector = DTId.sector(); 00452 00453 LocalPoint segmentPosition= segment->localPosition(); 00454 LocalVector segmentDirection=segment->localDirection(); 00455 00456 const GeomDet* gdet=dtGeo->idToDet(segment->geographicalId()); 00457 const BoundPlane & DTSurface = gdet->surface(); 00458 00459 //check if the dimension of the segment is 4 00460 00461 if(debug) std::cout<<"DT \t \t Is the segment 4D?"<<std::endl; 00462 00463 if(segment->dimension()==4){ 00464 00465 if(debug) std::cout<<"DT \t \t yes"<<std::endl; 00466 if(debug) std::cout<<"DT \t \t DT Segment Dimension "<<segment->dimension()<<std::endl; 00467 00468 float Xo=segmentPosition.x(); 00469 float Yo=segmentPosition.y(); 00470 float Zo=segmentPosition.z(); 00471 float dx=segmentDirection.x(); 00472 float dy=segmentDirection.y(); 00473 float dz=segmentDirection.z(); 00474 00475 std::set<RPCDetId> rollsForThisDT = rollstoreDT[DTStationIndex(0,dtWheel,dtSector,dtStation)]; 00476 00477 if(debug) std::cout<<"DT \t \t Number of rolls for this DT = "<<rollsForThisDT.size()<<std::endl; 00478 00479 assert(rollsForThisDT.size()>=1); 00480 00481 if(debug) std::cout<<"DT \t \t Loop over all the rolls asociated to this DT"<<std::endl; 00482 for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisDT.begin();iteraRoll != rollsForThisDT.end(); iteraRoll++){ 00483 const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll); 00484 RPCDetId rpcId = rollasociated->id(); 00485 const BoundPlane & RPCSurface = rollasociated->surface(); 00486 00487 RPCGeomServ rpcsrv(rpcId); 00488 std::string nameRoll = rpcsrv.name(); 00489 00490 if(debug) std::cout<<"DT \t \t \t RollName: "<<nameRoll<<std::endl; 00491 if(debug) std::cout<<"DT \t \t \t Doing the extrapolation to this roll"<<std::endl; 00492 if(debug) std::cout<<"DT \t \t \t DT Segment Direction in DTLocal "<<segmentDirection<<std::endl; 00493 if(debug) std::cout<<"DT \t \t \t DT Segment Point in DTLocal "<<segmentPosition<<std::endl; 00494 00495 GlobalPoint CenterPointRollGlobal = RPCSurface.toGlobal(LocalPoint(0,0,0)); 00496 00497 LocalPoint CenterRollinDTFrame = DTSurface.toLocal(CenterPointRollGlobal); 00498 00499 if(debug) std::cout<<"DT \t \t \t Center (0,0,0) Roll In DTLocal"<<CenterRollinDTFrame<<std::endl; 00500 if(debug) std::cout<<"DT \t \t \t Center (0,0,0) of the Roll in Global"<<CenterPointRollGlobal<<std::endl; 00501 00502 float D=CenterRollinDTFrame.z(); 00503 00504 float X=Xo+dx*D/dz; 00505 float Y=Yo+dy*D/dz; 00506 float Z=D; 00507 00508 const RectangularStripTopology* top_= dynamic_cast<const RectangularStripTopology*> (&(rollasociated->topology())); 00509 LocalPoint xmin = top_->localPosition(0.); 00510 if(debug) std::cout<<"DT \t \t \t xmin of this Roll "<<xmin<<"cm"<<std::endl; 00511 LocalPoint xmax = top_->localPosition((float)rollasociated->nstrips()); 00512 if(debug) std::cout<<"DT \t \t \t xmax of this Roll "<<xmax<<"cm"<<std::endl; 00513 float rsize = fabs( xmax.x()-xmin.x() ); 00514 if(debug) std::cout<<"DT \t \t \t Roll Size "<<rsize<<"cm"<<std::endl; 00515 float stripl = top_->stripLength(); 00516 float stripw = top_->pitch(); 00517 00518 if(debug) std::cout<<"DT \t \t \t Strip Lenght "<<stripl<<"cm"<<std::endl; 00519 if(debug) std::cout<<"DT \t \t \t Strip Width "<<stripw<<"cm"<<std::endl; 00520 if(debug) std::cout<<"DT \t \t \t X Predicted in DTLocal= "<<X<<"cm"<<std::endl; 00521 if(debug) std::cout<<"DT \t \t \t Y Predicted in DTLocal= "<<Y<<"cm"<<std::endl; 00522 if(debug) std::cout<<"DT \t \t \t Z Predicted in DTLocal= "<<Z<<"cm"<<std::endl; 00523 00524 float extrapolatedDistance = sqrt((X-Xo)*(X-Xo)+(Y-Yo)*(Y-Yo)+(Z-Zo)*(Z-Zo)); 00525 00526 if(debug) std::cout<<"DT \t \t \t Is the distance of extrapolation less than MaxD? ="<<extrapolatedDistance<<"cm"<<"MaxD="<<MaxD<<"cm"<<std::endl; 00527 00528 if(extrapolatedDistance<=MaxD){ 00529 if(debug) std::cout<<"DT \t \t \t yes"<<std::endl; 00530 GlobalPoint GlobalPointExtrapolated = DTSurface.toGlobal(LocalPoint(X,Y,Z)); 00531 if(debug) std::cout<<"DT \t \t \t Point ExtraPolated in Global"<<GlobalPointExtrapolated<< std::endl; 00532 LocalPoint PointExtrapolatedRPCFrame = RPCSurface.toLocal(GlobalPointExtrapolated); 00533 00534 if(debug) std::cout<<"DT \t \t \t Point Extrapolated in RPCLocal"<<PointExtrapolatedRPCFrame<< std::endl; 00535 if(debug) std::cout<<"DT \t \t \t Corner of the Roll = ("<<rsize*0.5<<","<<stripl*0.5<<")"<<std::endl; 00536 if(debug) std::cout<<"DT \t \t \t Info About the Point Extrapolated in X Abs ("<<fabs(PointExtrapolatedRPCFrame.x())<<"," 00537 <<fabs(PointExtrapolatedRPCFrame.y())<<","<<fabs(PointExtrapolatedRPCFrame.z())<<")"<<std::endl; 00538 if(debug) std::cout<<"DT \t \t \t Does the extrapolation go inside this roll?"<<std::endl; 00539 00540 if(fabs(PointExtrapolatedRPCFrame.z()) < 10. && 00541 fabs(PointExtrapolatedRPCFrame.x()) < rsize*0.5 && 00542 fabs(PointExtrapolatedRPCFrame.y()) < stripl*0.5){ 00543 00544 if(debug) std::cout<<"DT \t \t \t \t yes"<<std::endl; 00545 00546 RPCDetId rollId = rollasociated->id(); 00547 00548 RPCGeomServ rpcsrv(rollId); 00549 std::string nameRoll = rpcsrv.name(); 00550 if(debug) std::cout<<"DT \t \t \t \t The RPCName is "<<nameRoll<<std::endl; 00551 const float stripPredicted = 00552 rollasociated->strip(LocalPoint(PointExtrapolatedRPCFrame.x(),PointExtrapolatedRPCFrame.y(),0.)); 00553 00554 if(debug) std::cout<<"DT \t \t \t \t Candidate (from DT Segment) STRIP---> "<<stripPredicted<< std::endl; 00555 //---- HISTOGRAM STRIP PREDICTED FROM DT ---- 00556 char detUnitLabel[128]; 00557 sprintf(detUnitLabel ,"%s",nameRoll.c_str()); 00558 sprintf(layerLabel ,"%s",nameRoll.c_str()); 00559 00560 std::map<std::string, MonitorElement*> meMap=meCollection[nameRoll]; 00561 00562 sprintf(meIdDT,"ExpectedOccupancyFromDT_%s",detUnitLabel); 00563 if(debug) std::cout<<"DT \t \t \t \t Filling Expected for "<<meIdDT<<" with "<<stripPredicted<<std::endl; 00564 if(fabs(stripPredicted-rollasociated->nstrips())<1.) if(debug) std::cout<<"DT \t \t \t \t Extrapolating near last strip, Event"<<iEvent.id()<<" stripPredicted="<<stripPredicted<<" Number of strips="<<rollasociated->nstrips()<<std::endl; 00565 if(fabs(stripPredicted)<1.) if(debug) std::cout<<"DT \t \t \t \t Extrapolating near first strip, Event"<<iEvent.id()<<" stripPredicted="<<stripPredicted<<" Number of strips="<<rollasociated->nstrips()<<std::endl; 00566 meMap[meIdDT]->Fill(stripPredicted); 00567 //----------------------------------------------------- 00568 00569 00570 //-------RecHitPart Just For Residual-------- 00571 int countRecHits = 0; 00572 int cluSize = 0; 00573 float minres = 3000.; 00574 00575 if(debug) std::cout<<"DT \t \t \t \t Getting RecHits in Roll Asociated"<<std::endl; 00576 typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits; 00577 rangeRecHits recHitCollection = rpcHits->get(rollasociated->id()); 00578 RPCRecHitCollection::const_iterator recHit; 00579 00580 for (recHit = recHitCollection.first; recHit != recHitCollection.second ; recHit++) { 00581 countRecHits++; 00582 LocalPoint recHitPos=recHit->localPosition(); 00583 float res=PointExtrapolatedRPCFrame.x()- recHitPos.x(); 00584 if(debug) std::cout<<"DT \t \t \t \t \t Found Rec Hit at "<<res<<"cm of the prediction."<<std::endl; 00585 if(fabs(res)<fabs(minres)){ 00586 minres=res; 00587 cluSize = recHit->clusterSize(); 00588 if(debug) std::cout<<"DT \t \t \t \t \t \t New Min Res "<<res<<"cm."<<std::endl; 00589 } 00590 } 00591 00592 bool anycoincidence=false; 00593 00594 if(countRecHits==0){ 00595 if(debug) std::cout <<"DT \t \t \t \t \t THIS ROLL DOESN'T HAVE ANY RECHIT"<<std::endl; 00596 }else{ 00597 assert(minres!=3000); 00598 00599 if(debug) std::cout<<"DT \t \t \t \t \t PointExtrapolatedRPCFrame.x="<<PointExtrapolatedRPCFrame.x()<<" Minimal Residual="<<minres<<std::endl; 00600 if(debug) std::cout<<"DT \t \t \t \t \t Minimal Residual less than stripw*rangestrips? minres="<<minres<<" range="<<rangestrips<<" stripw="<<stripw<<" cluSize"<<cluSize<<" <=compare minres with"<<(rangestrips+cluSize*0.5)*stripw<<std::endl; 00601 if(fabs(minres)<=(rangestrips+cluSize*0.5)*stripw){ 00602 if(debug) std::cout<<"DT \t \t \t \t \t \t True!"<<std::endl; 00603 anycoincidence=true; 00604 } 00605 } 00606 if(anycoincidence){ 00607 if(debug) std::cout<<"DT \t \t \t \t \t At least one RecHit inside the range, Predicted="<<stripPredicted<<" minres="<<minres<<"cm range="<<rangestrips<<"strips stripw="<<stripw<<"cm"<<std::endl; 00608 if(debug) std::cout<<"DT \t \t \t \t \t Norm of Cosine Directors="<<dx*dx+dy*dy+dz*dz<<"~1?"<<std::endl; 00609 00610 //-----RESIDUALS---------- 00611 if(inves){ 00612 float cosal = dx/sqrt(dx*dx+dz*dz); 00613 if(debug) std::cout<<"DT \t \t \t \t \t Angle="<<acos(cosal)*180/3.1415926<<" degree"<<std::endl; 00614 if(debug) std::cout<<"DT \t \t \t \t \t Filling the Residuals Histogram for globals with "<<minres<<"And the angular incidence with Cos Alpha="<<cosal<<std::endl; 00615 if(rollId.station()==1&&rollId.layer()==1) { if(cluSize==1*dupli) {hGlobalResClu1La1->Fill(minres); AngClu1La1->Fill(acos(cosal)); DistBorderClu1La1->Fill(minres/stripw+0.5);}if(cluSize==2*dupli){ hGlobalResClu2La1->Fill(minres); AngClu2La1->Fill(acos(cosal));DistBorderClu2La1->Fill(minres/stripw+0.5);} if(cluSize==3*dupli){ hGlobalResClu3La1->Fill(minres); AngClu3La1->Fill(acos(cosal));} DistBorderClu3La1->Fill(minres/stripw+0.5);} 00616 else if(rollId.station()==1&&rollId.layer()==2){ if(cluSize==1*dupli) {hGlobalResClu1La2->Fill(minres); AngClu1La2->Fill(acos(cosal)); DistBorderClu1La2->Fill(minres/stripw+0.5);}if(cluSize==2*dupli){ hGlobalResClu2La2->Fill(minres); AngClu2La2->Fill(acos(cosal));DistBorderClu2La2->Fill(minres/stripw+0.5);} if(cluSize==3*dupli){ hGlobalResClu3La2->Fill(minres); AngClu3La2->Fill(acos(cosal));} DistBorderClu3La2->Fill(minres/stripw+0.5);} 00617 else if(rollId.station()==2&&rollId.layer()==1){ if(cluSize==1*dupli) {hGlobalResClu1La3->Fill(minres); AngClu1La3->Fill(acos(cosal)); DistBorderClu1La3->Fill(minres/stripw+0.5);}if(cluSize==2*dupli){ hGlobalResClu2La3->Fill(minres); AngClu2La3->Fill(acos(cosal));DistBorderClu2La3->Fill(minres/stripw+0.5);} if(cluSize==3*dupli){ hGlobalResClu3La3->Fill(minres); AngClu3La3->Fill(acos(cosal));} DistBorderClu3La3->Fill(minres/stripw+0.5);} 00618 else if(rollId.station()==2&&rollId.layer()==2){ if(cluSize==1*dupli) {hGlobalResClu1La4->Fill(minres); AngClu1La4->Fill(acos(cosal)); DistBorderClu1La4->Fill(minres/stripw+0.5);}if(cluSize==2*dupli){ hGlobalResClu2La4->Fill(minres); AngClu2La4->Fill(acos(cosal));DistBorderClu2La4->Fill(minres/stripw+0.5);} if(cluSize==3*dupli){ hGlobalResClu3La4->Fill(minres); AngClu3La4->Fill(acos(cosal));} DistBorderClu3La4->Fill(minres/stripw+0.5);} 00619 else if(rollId.station()==3) { if(cluSize==1*dupli) {hGlobalResClu1La5->Fill(minres); AngClu1La5->Fill(acos(cosal)); DistBorderClu1La5->Fill(minres/stripw+0.5);}if(cluSize==2*dupli){ hGlobalResClu2La5->Fill(minres); AngClu2La5->Fill(acos(cosal));DistBorderClu2La5->Fill(minres/stripw+0.5);} if(cluSize==3*dupli){ hGlobalResClu3La5->Fill(minres); AngClu3La5->Fill(acos(cosal));} DistBorderClu3La5->Fill(minres/stripw+0.5);} 00620 //------------------------ 00621 } 00622 sprintf(meIdRPC,"RPCDataOccupancyFromDT_%s",detUnitLabel); 00623 if(debug) std::cout<<"DT \t \t \t \t \t COINCIDENCE!!! Event="<<iEvent.id()<<" Filling RPC Data Occupancy for "<<meIdRPC<<" with "<<stripPredicted<<std::endl; 00624 meMap[meIdRPC]->Fill(stripPredicted); 00625 } 00626 else{ 00627 RPCGeomServ rpcsrv(rollasociated->id()); 00628 std::string nameRoll = rpcsrv.name(); 00629 if(debug) std::cout<<"DT \t \t \t \t \t A roll was ineficient in event "<<iEvent.id().event()<<std::endl; 00630 if(debug) ofrej<<"DTs \t Wh "<<dtWheel 00631 <<"\t St "<<dtStation 00632 <<"\t Se "<<dtSector 00633 <<"\t Roll "<<nameRoll 00634 <<"\t Event " 00635 <<iEvent.id().event() 00636 <<"\t Run " 00637 <<iEvent.id().run() 00638 <<std::endl; 00639 } 00640 }else { 00641 if(debug) std::cout<<"DT \t \t \t \t No the prediction is outside of this roll"<<std::endl; 00642 }//Condition for the right match 00643 }else{ 00644 if(debug) std::cout<<"DT \t \t \t No, Exrtrapolation too long!, canceled"<<std::endl; 00645 }//D so big 00646 }//loop over all the rolls asociated 00647 }//Is the segment 4D? 00648 }else { 00649 if(debug) std::cout<<"DT \t \t More than one segment in this chamber, or we are in Station 4"<<std::endl; 00650 } 00651 } 00652 } 00653 else { 00654 if(debug) std::cout<<"DT This Event doesn't have any DT4DDSegment"<<std::endl; //is ther more than 1 segment in this event? 00655 } 00656 } 00657 00658 if(incldtMB4){ 00659 if(debug) std::cout <<"MB4 \t Getting ALL the DT Segments"<<std::endl; 00660 edm::Handle<DTRecSegment4DCollection> all4DSegments; 00661 iEvent.getByLabel(dt4DSegments, all4DSegments); 00662 00663 if(all4DSegments->size()>0){ 00664 00665 std::map<DTChamberId,int> DTSegmentCounter; 00666 DTRecSegment4DCollection::const_iterator segment; 00667 00668 for (segment = all4DSegments->begin();segment!=all4DSegments->end(); ++segment){ 00669 DTSegmentCounter[segment->chamberId()]++; 00670 } 00671 00672 if(debug) std::cout<<"MB4 \t \t Loop Over all4DSegments"<<std::endl; 00673 for (segment = all4DSegments->begin(); segment != all4DSegments->end(); ++segment){ 00674 00675 DTChamberId DTId = segment->chamberId(); 00676 00677 if(debug) std::cout<<"MB4 \t \t \t Is the only one in the chamber? and is in the Station 4?"<<std::endl; 00678 00679 if(DTSegmentCounter[DTId] == 1 && DTId.station()==4){ 00680 00681 if(debug) std::cout<<"MB4 \t \t \t yes"<<std::endl; 00682 int dtWheel = DTId.wheel(); 00683 int dtStation = DTId.station(); 00684 int dtSector = DTId.sector(); 00685 00686 LocalPoint segmentPosition= segment->localPosition(); 00687 LocalVector segmentDirection=segment->localDirection(); 00688 00689 //check if the dimension of the segment is 2 and the station is 4 00690 00691 00692 if(debug) std::cout<<"MB4 \t \t \t \t The Segment in MB4 is 2D?"<<std::endl; 00693 if(segment->dimension()==2){ 00694 if(debug) std::cout<<"MB4 \t \t \t \t yes"<<std::endl; 00695 LocalVector segmentDirectionMB4=segmentDirection; 00696 LocalPoint segmentPositionMB4=segmentPosition; 00697 00698 bool compatiblesegments=false; 00699 float dx=segmentDirectionMB4.x(); 00700 float dz=segmentDirectionMB4.z(); 00701 00702 const BoundPlane& DTSurface4 = dtGeo->idToDet(DTId)->surface(); 00703 00704 DTRecSegment4DCollection::const_iterator segMB3; 00705 00706 if(debug) std::cout<<"MB4 \t \t \t \t Loop on segments in =sector && MB3 && adjacent Wheel && y dim=4"<<std::endl; 00707 for(segMB3=all4DSegments->begin();segMB3!=all4DSegments->end();++segMB3){ 00708 00709 DTChamberId dtid3 = segMB3->chamberId(); 00710 00711 if(dtid3.sector()==DTId.sector() 00712 && dtid3.station()==3 00713 && abs(dtid3.wheel()-DTId.wheel())<2 00714 && DTSegmentCounter[dtid3] == 1 00715 && segMB3->dimension()==4){ 00716 00717 const GeomDet* gdet3=dtGeo->idToDet(segMB3->geographicalId()); 00718 const BoundPlane & DTSurface3 = gdet3->surface(); 00719 00720 float dx3=segMB3->localDirection().x(); 00721 float dy3=segMB3->localDirection().y(); 00722 float dz3=segMB3->localDirection().z(); 00723 00724 LocalVector segDirMB4inMB3Frame=DTSurface3.toLocal(DTSurface4.toGlobal(segmentDirectionMB4)); 00725 00726 double cosAng=fabs(dx*dx3+dz*dz3/sqrt((dx3*dx3+dz3*dz3)*(dx*dx+dz*dz))); 00727 if(fabs(cosAng)>1.){ 00728 std::cout<<"dx="<<dx<<" dz="<<dz<<std::endl; 00729 std::cout<<"dx3="<<dx3<<" dz3="<<dz<<std::endl; 00730 std::cout<<cosAng<<std::endl; 00731 } 00732 00733 if(cosAng>MinCosAng){ 00734 compatiblesegments=true; 00735 if(dtSector==13){ 00736 dtSector=4; 00737 } 00738 if(dtSector==14){ 00739 dtSector=10; 00740 } 00741 00742 std::set<RPCDetId> rollsForThisDT = rollstoreDT[DTStationIndex(0,dtWheel,dtSector,4)]; //It should be always 4 00743 00744 assert(rollsForThisDT.size()>=1); 00745 00746 for (std::set<RPCDetId>::iterator iteraRoll=rollsForThisDT.begin();iteraRoll != rollsForThisDT.end(); iteraRoll++){ 00747 const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll); //roll asociado a MB4 00748 const BoundPlane & RPCSurfaceRB4 = rollasociated->surface(); //surface MB4 00749 const GeomDet* gdet=dtGeo->idToDet(segMB3->geographicalId()); 00750 const BoundPlane & DTSurfaceMB3 = gdet->surface(); // surface MB3 00751 00752 GlobalPoint CenterPointRollGlobal=RPCSurfaceRB4.toGlobal(LocalPoint(0,0,0)); 00753 00754 LocalPoint CenterRollinMB3Frame = DTSurfaceMB3.toLocal(CenterPointRollGlobal); 00755 00756 float D=CenterRollinMB3Frame.z(); 00757 00758 float Xo3=segMB3->localPosition().x(); 00759 float Yo3=segMB3->localPosition().y(); 00760 float Zo3=segMB3->localPosition().z(); 00761 00762 float X=Xo3+dx3*D/dz3; 00763 float Y=Yo3+dy3*D/dz3; 00764 float Z=D; 00765 00766 00767 const RectangularStripTopology* top_ 00768 =dynamic_cast<const RectangularStripTopology*>(&(rollasociated->topology())); //Topology roll asociated MB4 00769 LocalPoint xmin = top_->localPosition(0.); 00770 LocalPoint xmax = top_->localPosition((float)rollasociated->nstrips()); 00771 float rsize = fabs( xmax.x()-xmin.x() ); 00772 float stripl = top_->stripLength(); 00773 float stripw = top_->pitch(); 00774 00775 00776 if(debug) std::cout<<"MB4 \t \t \t Strip Lenght "<<stripl<<"cm"<<std::endl; 00777 if(debug) std::cout<<"MB4 \t \t \t Strip Width "<<stripw<<"cm"<<std::endl; 00778 00779 if(debug) std::cout<<"MB4 \t \t \t X Predicted in MB3Local= "<<X<<"cm"<<std::endl; 00780 if(debug) std::cout<<"MB4 \t \t \t Y Predicted in MB3DTLocal= "<<Y<<"cm"<<std::endl; 00781 if(debug) std::cout<<"MB4 \t \t \t Z Predicted in MB3DTLocal= "<<Z<<"cm"<<std::endl; 00782 00783 float extrapolatedDistance = sqrt((X-Xo3)*(X-Xo3)+(Y-Yo3)*(Y-Yo3)+(Z-Zo3)*(Z-Zo3)); 00784 00785 if(extrapolatedDistance<=MaxDrb4){ 00786 if(debug) std::cout<<"MB4 \t \t \t yes"<<std::endl; 00787 00788 GlobalPoint GlobalPointExtrapolated = DTSurfaceMB3.toGlobal(LocalPoint(X,Y,Z)); 00789 00790 if(debug) std::cout<<"MB4 \t \t \t Point ExtraPolated in Global"<<GlobalPointExtrapolated<< std::endl; 00791 00792 LocalPoint PointExtrapolatedRPCFrame = RPCSurfaceRB4.toLocal(GlobalPointExtrapolated); 00793 00794 if(debug) std::cout<<"MB4 \t \t \t Point Extrapolated in RPCLocal"<<PointExtrapolatedRPCFrame<< std::endl; 00795 if(debug) std::cout<<"MB4 \t \t \t Corner of the Roll = ("<<rsize*0.5<<","<<stripl*0.5<<")"<<std::endl; 00796 if(debug) std::cout<<"MB4 \t \t \t Info About the Point Extrapolated in X Abs ("<<fabs(PointExtrapolatedRPCFrame.x())<<"," 00797 <<fabs(PointExtrapolatedRPCFrame.y())<<","<<fabs(PointExtrapolatedRPCFrame.z())<<")"<<std::endl; 00798 00799 if(debug) std::cout<<"MB4 \t \t \t Does the extrapolation go inside this roll?"<<std::endl; 00800 00801 if(fabs(PointExtrapolatedRPCFrame.z()) < 10. && 00802 fabs(PointExtrapolatedRPCFrame.x()) < rsize*0.5 && 00803 fabs(PointExtrapolatedRPCFrame.y()) < stripl*0.5){ 00804 00805 if(debug) std::cout<<"MB4 \t \t \t \t yes"<<std::endl; 00806 00807 RPCDetId rollId = rollasociated->id(); 00808 00809 RPCGeomServ rpcsrv(rollId); 00810 std::string nameRoll = rpcsrv.name(); 00811 if(debug) std::cout<<"MB4 \t \t \t \t \t The RPCName is "<<nameRoll<<std::endl; 00812 const float stripPredicted= 00813 rollasociated->strip(LocalPoint(PointExtrapolatedRPCFrame.x(),PointExtrapolatedRPCFrame.y(),0.)); 00814 00815 if(debug) std::cout<<"MB4 \t \t \t \t Candidate (from DT Segment) STRIP---> "<<stripPredicted<< std::endl; 00816 //--------- HISTOGRAM STRIP PREDICTED FROM DT MB4 ------------------- 00817 char detUnitLabel[128]; 00818 sprintf(detUnitLabel ,"%s",nameRoll.c_str()); 00819 sprintf(layerLabel ,"%s",nameRoll.c_str()); 00820 00821 std::map<std::string, MonitorElement*> meMap=meCollection[nameRoll]; 00822 00823 if(debug) std::cout<<"MB4 \t \t \t \t \t Filling Expected"<<std::endl; 00824 sprintf(meIdDT,"ExpectedOccupancyFromDT_%s",detUnitLabel); 00825 meMap[meIdDT]->Fill(stripPredicted); 00826 //------------------------------------------------- 00827 00828 00829 //-------RecHitPart Just For Residual-------- 00830 int countRecHits = 0; 00831 int cluSize = 0; 00832 float minres = 3000.; 00833 00834 if(debug) std::cout<<"MB4 \t \t \t \t Getting RecHits in Roll Asociated"<<std::endl; 00835 typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits; 00836 rangeRecHits recHitCollection = rpcHits->get(rollasociated->id()); 00837 RPCRecHitCollection::const_iterator recHit; 00838 00839 for (recHit = recHitCollection.first; recHit != recHitCollection.second ; recHit++) { 00840 countRecHits++; 00841 LocalPoint recHitPos=recHit->localPosition(); 00842 float res=PointExtrapolatedRPCFrame.x()- recHitPos.x(); 00843 if(debug) std::cout<<"DT \t \t \t \t \t Found Rec Hit at "<<res<<"cm of the prediction."<<std::endl; 00844 if(fabs(res)<fabs(minres)){ 00845 minres=res; 00846 cluSize = recHit->clusterSize(); 00847 } 00848 } 00849 00850 bool anycoincidence=false; 00851 00852 if(countRecHits==0){ 00853 if(debug) std::cout <<"MB4 \t \t \t \t \t \t THIS ROLL DOESN'T HAVE ANY RECHIT"<<std::endl; 00854 }else{ 00855 assert(minres!=3000); 00856 00857 if(debug) std::cout<<"MB4 \t \t \t \t \t \t PointExtrapolatedRPCFrame.x="<<PointExtrapolatedRPCFrame.x()<<" Minimal Residual ="<<minres<<std::endl; 00858 if(debug) std::cout<<"MB4 \t \t \t \t \t \t Minimal Residual less than stripw*rangestrips? minres="<<minres<<" range="<<rangestrips<<" stripw="<<stripw<<" cluSize"<<cluSize<<" <=compare minres with"<<(rangestrips+cluSize*0.5)*stripw<<std::endl; 00859 if(fabs(minres)<=(rangestrips+cluSize*0.5)*stripw){ 00860 if(debug) std::cout<<"MB4 \t \t \t \t \t \t \t True!"<<std::endl; 00861 anycoincidence=true; 00862 } 00863 } 00864 if(anycoincidence){ 00865 if(debug) std::cout<<"MB4 \t \t \t \t \t At least one RecHit inside the range, Predicted="<<stripPredicted<<" minres="<<minres<<"cm range="<<rangestrips<<"strips stripw="<<stripw<<"cm"<<std::endl; 00866 if(debug) std::cout<<"MB4 \t \t \t \t \t Norm of Cosine Directors="<<dx3*dx3+dy3*dy3+dz3*dz3<<"~1?"<<std::endl; 00867 00868 //-----RESIDUALS---------- 00869 if(inves){ 00870 float cosal = dx/sqrt(dx*dx+dz*dz); 00871 if(debug) std::cout<<"MB4 \t \t \t \t \t Angle="<<acos(cosal)*180/3.1415926<<" degree"<<std::endl; 00872 if(debug) std::cout<<"MB4 \t \t \t \t \t Filling the Residuals Histogram for globals with "<<minres<<"And the angular incidence with Cos Theta="<<-1*dz<<std::endl; 00873 assert(rollId.station()==4); 00874 if(cluSize==1*dupli){ hGlobalResClu1La6->Fill(minres); if(minres<0.005*stripw) AngClu1La6->Fill(acos(cosal)); if(fabs(minres)<stripw*0.5) DistBorderClu1La6->Fill(minres/stripw+0.5);} 00875 else if(cluSize==2*dupli){ hGlobalResClu2La6->Fill(minres); if(minres<0.005*stripw) AngClu2La6->Fill(acos(cosal));} 00876 else if(cluSize==3*dupli){ hGlobalResClu3La6->Fill(minres); if(minres<0.005*stripw) AngClu3La6->Fill(acos(cosal));} 00877 } 00878 //-------------------------------- 00879 00880 sprintf(meIdRPC,"RPCDataOccupancyFromDT_%s",detUnitLabel); 00881 if(debug) std::cout<<"MB4 \t \t \t \t \t \t COINCIDENCE!!! Event="<<iEvent.id()<<"Filling RPC Data Occupancy for "<<meIdRPC<<" with "<<stripPredicted<<std::endl; 00882 meMap[meIdRPC]->Fill(stripPredicted); 00883 } 00884 else{ 00885 RPCGeomServ rpcsrv(rollasociated->id()); 00886 std::string nameRoll = rpcsrv.name(); 00887 if(debug) std::cout<<"MB4 \t \t \t \t \t \t A roll was ineficient in event"<<iEvent.id().event()<<std::endl; 00888 if(debug) ofrej<<"MB4 \t Wh "<<dtWheel 00889 <<"\t St "<<dtStation 00890 <<"\t Se "<<dtSector 00891 <<"\t Roll "<<nameRoll 00892 <<"\t Event " 00893 <<iEvent.id().event() 00894 <<"\t Run " 00895 <<iEvent.id().run() 00896 <<std::endl; 00897 } 00898 }else{ 00899 if(debug) std::cout<<"MB4 \t \t \t \t No the prediction is outside of this roll"<<std::endl; 00900 } 00901 }//Condition for the right match 00902 else{ 00903 if(debug) std::cout<<"MB4 \t \t \t No, Exrtrapolation too long!, canceled"<<std::endl; 00904 } 00905 }//loop over all the rollsasociated 00906 }else{ 00907 compatiblesegments=false; 00908 if(debug) std::cout<<"MB4 \t \t \t \t I found segments in MB4 and MB3 adjacent or same wheel and sector but not compatibles Diferent Directions"<<std::endl; 00909 } 00910 }else{//if dtid3.station()==3&&dtid3.sector()==DTId.sector()&&dtid3.wheel()==DTId.wheel()&&segMB3->dim()==4 00911 if(debug) std::cout<<"MB4 \t \t \t No the same station or same wheel or segment dim in mb3 not 4D"<<std::endl; 00912 } 00913 }//loop over all the segments looking for one in MB3 00914 }else{ 00915 if(debug) std::cout<<"MB4 \t \t \t Is NOT a 2D Segment"<<std::endl; 00916 } 00917 }else{ 00918 if(debug) std::cout<<"MB4 \t \t \t \t There is not just one segment or is not in station 4"<<std::endl; 00919 }//De aca para abajo esta en dtpart.inl 00920 } 00921 }else{ 00922 if(debug) std::cout<<"MB4 \t This event doesn't have 4D Segment"<<std::endl; 00923 } 00924 } 00925 00926 if(inclcsc){ 00927 if(debug) std::cout <<"\t Getting the CSC Segments"<<std::endl; 00928 edm::Handle<CSCSegmentCollection> allCSCSegments; 00929 iEvent.getByLabel(cscSegments, allCSCSegments); 00930 00931 if(allCSCSegments->size()>0){ 00932 statistics->Fill(18); 00933 00934 if(debug) std::cout<<"CSC \t Number of CSC Segments in this event = "<<allCSCSegments->size()<<std::endl; 00935 00936 std::map<CSCDetId,int> CSCSegmentsCounter; 00937 CSCSegmentCollection::const_iterator segment; 00938 00939 int segmentsInThisEventInTheEndcap=0; 00940 00941 for (segment = allCSCSegments->begin();segment!=allCSCSegments->end(); ++segment){ 00942 CSCSegmentsCounter[segment->cscDetId()]++; 00943 segmentsInThisEventInTheEndcap++; 00944 } 00945 00946 statistics->Fill(allCSCSegments->size()+18); 00947 00948 00949 if(debug) std::cout<<"CSC \t loop over all the CSCSegments "<<std::endl; 00950 for (segment = allCSCSegments->begin();segment!=allCSCSegments->end(); ++segment){ 00951 CSCDetId CSCId = segment->cscDetId(); 00952 00953 if(debug) std::cout<<"CSC \t \t This Segment is in Chamber id: "<<CSCId<<std::endl; 00954 if(debug) std::cout<<"CSC \t \t Number of segments in this CSC = "<<CSCSegmentsCounter[CSCId]<<std::endl; 00955 if(debug) std::cout<<"CSC \t \t Is the only one in this CSC? is not ind the ring 1 or station 4? Are there more than 2 segments in the event?"<<std::endl; 00956 00957 if(CSCSegmentsCounter[CSCId]==1 && CSCId.station()!=4 && CSCId.ring()!=1 && allCSCSegments->size()>=2){ 00958 if(debug) std::cout<<"CSC \t \t yes"<<std::endl; 00959 int cscEndCap = CSCId.endcap(); 00960 int cscStation = CSCId.station(); 00961 int cscRing = CSCId.ring(); 00962 int cscChamber = CSCId.chamber(); 00963 int rpcRegion = 1; if(cscEndCap==2) rpcRegion= -1;//Relacion entre las endcaps 00964 int rpcRing = cscRing; 00965 if(cscRing==4)rpcRing =1; 00966 int rpcStation = cscStation; 00967 int rpcSegment = 0; 00968 00969 if(cscStation!=1&&cscRing==1){//las de 18 CSC 00970 rpcSegment = CSCId.chamber(); 00971 } 00972 else{//las de 36 CSC 00973 rpcSegment = (CSCId.chamber()==1) ? 36 : CSCId.chamber()-1; 00974 } 00975 00976 LocalPoint segmentPosition= segment->localPosition(); 00977 LocalVector segmentDirection=segment->localDirection(); 00978 float dz=segmentDirection.z(); 00979 00980 if(debug) std::cout<<"CSC \t \t Is a good Segment? dim = 4, 4 <= nRecHits <= 10 Incident angle int range 45 < "<<acos(dz)*180/3.1415926<<" < 135? "<<std::endl; 00981 00982 if(segment->dimension()==4 && (segment->nRecHits()<=10 && segment->nRecHits()>=4)&& acos(dz)*180/3.1415926 > 45. && acos(dz)*180/3.1415926 < 160. ){ 00983 00984 //&& segment->chi2()< ??)Add 3 segmentes in the endcaps??? 00985 00986 if(debug) std::cout<<"CSC \t \t yes"<<std::endl; 00987 if(debug) std::cout<<"CSC \t \t CSC Segment Dimension "<<segment->dimension()<<std::endl; 00988 00989 float Xo=segmentPosition.x(); 00990 float Yo=segmentPosition.y(); 00991 float Zo=segmentPosition.z(); 00992 float dx=segmentDirection.x(); 00993 float dy=segmentDirection.y(); 00994 float dz=segmentDirection.z(); 00995 00996 00997 if(debug) std::cout<<"CSC \t \t Getting chamber from Geometry"<<std::endl; 00998 const CSCChamber* TheChamber=cscGeo->chamber(CSCId); 00999 if(debug) std::cout<<"CSC \t \t Getting ID from Chamber"<<std::endl; 01000 const CSCDetId TheId=TheChamber->id(); 01001 if(debug) std::cout<<"CSC \t \t Printing The Id"<<TheId<<std::endl; 01002 std::set<RPCDetId> rollsForThisCSC = rollstoreCSC[CSCStationIndex(rpcRegion,rpcStation,rpcRing,rpcSegment)]; 01003 if(debug) std::cout<<"CSC \t \t Number of rolls for this CSC = "<<rollsForThisCSC.size()<<std::endl; 01004 01005 if(debug) std::cout<<"CSC \t \t Loop over all the rolls asociated to this CSC"<<std::endl; 01006 01007 if(rpcRing!=1&&rpcStation!=4){ 01008 01009 if(rollsForThisCSC.size()==0){ 01010 if(debug) std::cout<<"CSC Fail for CSCId="<<TheId<<" rpcRegion="<<rpcRegion<<" rpcStation="<<rpcStation<<" rpcRing="<<rpcRing<<" rpcSegment="<<rpcSegment<<std::endl; 01011 } 01012 01013 assert(rollsForThisCSC.size()>=1); 01014 01015 //Loop over all the rolls 01016 for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisCSC.begin();iteraRoll != rollsForThisCSC.end(); iteraRoll++){ 01017 const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll); 01018 RPCDetId rpcId = rollasociated->id(); 01019 01020 if(debug) std::cout<<"CSC \t \t \t We are in the roll getting the surface"<<rpcId<<std::endl; 01021 const BoundPlane & RPCSurface = rollasociated->surface(); 01022 01023 if(debug) std::cout<<"CSC \t \t \t RollID: "<<rpcId<<std::endl; 01024 01025 if(debug) std::cout<<"CSC \t \t \t Doing the extrapolation to this roll"<<std::endl; 01026 if(debug) std::cout<<"CSC \t \t \t CSC Segment Direction in CSCLocal "<<segmentDirection<<std::endl; 01027 if(debug) std::cout<<"CSC \t \t \t CSC Segment Point in CSCLocal "<<segmentPosition<<std::endl; 01028 01029 GlobalPoint CenterPointRollGlobal = RPCSurface.toGlobal(LocalPoint(0,0,0)); 01030 if(debug) std::cout<<"CSC \t \t \t Center (0,0,0) of the Roll in Global"<<CenterPointRollGlobal<<std::endl; 01031 GlobalPoint CenterPointCSCGlobal = TheChamber->toGlobal(LocalPoint(0,0,0)); 01032 if(debug) std::cout<<"CSC \t \t \t Center (0,0,0) of the CSC in Global"<<CenterPointCSCGlobal<<std::endl; 01033 GlobalPoint segmentPositionInGlobal=TheChamber->toGlobal(segmentPosition); //new way to convert to global 01034 if(debug) std::cout<<"CSC \t \t \t Segment Position in Global"<<segmentPositionInGlobal<<std::endl; 01035 LocalPoint CenterRollinCSCFrame = TheChamber->toLocal(CenterPointRollGlobal); 01036 01037 if(debug){//to check CSC RPC phi relation! 01038 float rpcphi=0; 01039 float cscphi=0; 01040 01041 (CenterPointRollGlobal.barePhi()<0)? 01042 rpcphi = 2*3.141592+CenterPointRollGlobal.barePhi():rpcphi=CenterPointRollGlobal.barePhi(); 01043 01044 (CenterPointCSCGlobal.barePhi()<0)? 01045 cscphi = 2*3.1415926536+CenterPointCSCGlobal.barePhi():cscphi=CenterPointCSCGlobal.barePhi(); 01046 01047 float df=fabs(cscphi-rpcphi); 01048 float dr=fabs(CenterPointRollGlobal.perp()-CenterPointCSCGlobal.perp()); 01049 float diffz=CenterPointRollGlobal.z()-CenterPointCSCGlobal.z(); 01050 float dfg=df*180./3.14159265; 01051 01052 if(debug) std::cout<<"CSC \t \t \t z of RPC="<<CenterPointRollGlobal.z()<<"z of CSC"<<CenterPointCSCGlobal.z()<<" dfg="<<dfg<<std::endl; 01053 01054 01055 RPCGeomServ rpcsrv(rpcId); 01056 01057 01058 if(dr>200.||fabs(dz)>55.||dfg>1.){ 01059 //if(rpcRegion==1&&dfg>1.&&dr>100.){ 01060 if (debug) std::cout 01061 <<"\t \t \t CSC Station= "<<CSCId.station() 01062 <<" Ring= "<<CSCId.ring() 01063 <<" Chamber= "<<CSCId.chamber() 01064 <<" cscphi="<<cscphi*180/3.14159265 01065 <<"\t RPC Station= "<<rpcId.station() 01066 <<" ring= "<<rpcId.ring() 01067 <<" segment =-> "<<mySegment(rpcId) 01068 <<" rollphi="<<rpcphi*180/3.14159265 01069 <<"\t dfg="<<dfg 01070 <<" dz="<<diffz 01071 <<" dr="<<dr 01072 <<std::endl; 01073 01074 } 01075 } 01076 01077 01078 01079 01080 float D=CenterRollinCSCFrame.z(); 01081 01082 float X=Xo+dx*D/dz; 01083 float Y=Yo+dy*D/dz; 01084 float Z=D; 01085 01086 const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(rollasociated->topology())); 01087 LocalPoint xmin = top_->localPosition(0.); 01088 if(debug) std::cout<<"CSC \t \t \t xmin of this Roll "<<xmin<<"cm"<<std::endl; 01089 LocalPoint xmax = top_->localPosition((float)rollasociated->nstrips()); 01090 if(debug) std::cout<<"CSC \t \t \t xmax of this Roll "<<xmax<<"cm"<<std::endl; 01091 float rsize = fabs( xmax.x()-xmin.x() ); 01092 if(debug) std::cout<<"CSC \t \t \t Roll Size "<<rsize<<"cm"<<std::endl; 01093 float stripl = top_->stripLength(); 01094 float stripw = top_->pitch(); 01095 01096 if(debug) std::cout<<"CSC \t \t \t Strip Lenght "<<stripl<<"cm"<<std::endl; 01097 if(debug) std::cout<<"CSC \t \t \t Strip Width "<<stripw<<"cm"<<std::endl; 01098 01099 if(debug) std::cout<<"CSC \t \t \t X Predicted in CSCLocal= "<<X<<"cm"<<std::endl; 01100 if(debug) std::cout<<"CSC \t \t \t Y Predicted in CSCLocal= "<<Y<<"cm"<<std::endl; 01101 if(debug) std::cout<<"CSC \t \t \t Z Predicted in CSCLocal= "<<Z<<"cm"<<std::endl; 01102 01103 float extrapolatedDistance = sqrt((X-Xo)*(X-Xo)+(Y-Yo)*(Y-Yo)+(Z-Zo)*(Z-Zo)); 01104 01105 if(debug) std::cout<<"CSC \t \t \t Is the distance of extrapolation less than MaxD? ="<<extrapolatedDistance<<"cm"<<"MaxD="<<MaxD<<"cm"<<std::endl; 01106 01107 if(extrapolatedDistance<=MaxD){ 01108 01109 if(debug) std::cout<<"CSC \t \t \t yes"<<std::endl; 01110 01111 GlobalPoint GlobalPointExtrapolated=TheChamber->toGlobal(LocalPoint(X,Y,Z)); 01112 if(debug) std::cout<<"CSC \t \t \t Point ExtraPolated in Global"<<GlobalPointExtrapolated<< std::endl; 01113 01114 01115 LocalPoint PointExtrapolatedRPCFrame = RPCSurface.toLocal(GlobalPointExtrapolated); 01116 01117 if(debug) std::cout<<"CSC \t \t \t Point Extrapolated in RPCLocal"<<PointExtrapolatedRPCFrame<< std::endl; 01118 if(debug) std::cout<<"CSC \t \t \t Corner of the Roll = ("<<rsize*0.5<<","<<stripl*0.5<<")"<<std::endl; 01119 if(debug) std::cout<<"CSC \t \t \t Info About the Point Extrapolated in X Abs ("<<fabs(PointExtrapolatedRPCFrame.x())<<"," 01120 <<fabs(PointExtrapolatedRPCFrame.y())<<","<<fabs(PointExtrapolatedRPCFrame.z())<<")"<<std::endl; 01121 if(debug) std::cout<<"CSC \t \t \t dz=" 01122 <<fabs(PointExtrapolatedRPCFrame.z())<<" dx=" 01123 <<fabs(PointExtrapolatedRPCFrame.x())<<" dy=" 01124 <<fabs(PointExtrapolatedRPCFrame.y())<<std::endl; 01125 01126 if(debug) std::cout<<"CSC \t \t \t Does the extrapolation go inside this roll????"<<std::endl; 01127 01128 if(fabs(PointExtrapolatedRPCFrame.z()) < 10. && 01129 fabs(PointExtrapolatedRPCFrame.x()) < rsize*0.5 && 01130 fabs(PointExtrapolatedRPCFrame.y()) < stripl*0.5){ 01131 01132 if(debug) std::cout<<"CSC \t \t \t \t yes"<<std::endl; 01133 01134 RPCDetId rollId = rollasociated->id(); 01135 01136 RPCGeomServ rpcsrv(rollId); 01137 std::string nameRoll = rpcsrv.name(); 01138 if(debug) std::cout<<"CSC \t \t \t \t The RPCName is "<<nameRoll<<std::endl; 01139 01140 const float stripPredicted = 01141 rollasociated->strip(LocalPoint(PointExtrapolatedRPCFrame.x(),PointExtrapolatedRPCFrame.y(),0.)); 01142 01143 if(debug) std::cout<<"CSC \t \t \t \t \t Candidate"<<rollId<<" "<<"(from CSC Segment) STRIP---> "<<stripPredicted<< std::endl; 01144 //--------- HISTOGRAM STRIP PREDICTED FROM CSC ------------------- 01145 01146 char detUnitLabel[128]; 01147 sprintf(detUnitLabel ,"%s",nameRoll.c_str()); 01148 sprintf(layerLabel ,"%s",nameRoll.c_str()); 01149 01150 std::map<std::string, MonitorElement*> meMap=meCollection[nameRoll]; 01151 01152 if(debug) std::cout<<"CSC \t \t \t \t Filling Expected"<<std::endl; 01153 sprintf(meIdCSC,"ExpectedOccupancyFromCSC_%s",detUnitLabel); 01154 meMap[meIdCSC]->Fill(stripPredicted); 01155 //-------------------------------------------------------------------- 01156 01157 01158 //-------RecHitPart Just For Residual-------- 01159 int cluSize = 0; 01160 int countRecHits = 0; 01161 float minres = 3000.; 01162 01163 if(debug) std::cout<<"CSC \t \t \t \t \t Getting RecHits in Roll Asociated"<<std::endl; 01164 typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits; 01165 rangeRecHits recHitCollection = rpcHits->get(rollasociated->id()); 01166 RPCRecHitCollection::const_iterator recHit; 01167 01168 for (recHit = recHitCollection.first; recHit != recHitCollection.second ; recHit++) { 01169 countRecHits++; 01170 LocalPoint recHitPos=recHit->localPosition(); 01171 float res=PointExtrapolatedRPCFrame.x()- recHitPos.x(); 01172 if(debug) std::cout<<"CSC \t \t \t \t \t \t Found Rec Hit at "<<res<<"cm of the prediction."<<std::endl; 01173 if(fabs(res)<fabs(minres)){ 01174 minres=res; 01175 cluSize = recHit->clusterSize(); 01176 if(debug) std::cout<<"CSC \t \t \t \t \t \t \t New Min Res "<<res<<"cm."<<std::endl; 01177 } 01178 } 01179 01180 bool anycoincidence = false; 01181 01182 if(countRecHits==0){ 01183 if(debug) std::cout <<"CSC \t \t \t \t \t THIS ROLL DOESN'T HAVE ANY RECHIT"<<std::endl; 01184 }else{ 01185 assert(minres!=3000); 01186 01187 if(debug) std::cout<<"CSC \t \t \t \t \t PointExtrapolatedRPCFrame.x="<<PointExtrapolatedRPCFrame.x()<<" Minimal Residual"<<minres<<std::endl; 01188 if(debug) std::cout<<"CSC \t \t \t \t \t Minimal Residual less than stripw*rangestrips? minres="<<minres<<" range="<<rangestrips<<" stripw="<<stripw<<" cluSize"<<cluSize<<" <=compare minres with"<<(rangestrips+cluSize*0.5)*stripw<<std::endl; 01189 if(fabs(minres)<=(rangestrips+cluSize*0.5)*stripw){ 01190 if(debug) std::cout<<"CSC \t \t \t \t \t \t True!"<<std::endl; 01191 anycoincidence=true; 01192 } 01193 } 01194 if(anycoincidence){ 01195 if(debug) std::cout<<"CSC \t \t \t \t \t At least one RecHit inside the range, Predicted="<<stripPredicted<<" minres="<<minres<<"cm range="<<rangestrips<<"strips stripw="<<stripw<<"cm"<<std::endl; 01196 if(debug) std::cout<<"CSC \t \t \t \t \t Norm of Cosine Directors="<<dx*dx+dy*dy+dz*dz<<"~1?"<<std::endl; 01197 01198 //----RESIDUALS---- 01199 if(inves){ 01200 if(rollId.ring()==2&&rollId.roll()==1){if(cluSize==1*dupli) hGlobalResClu1R2A->Fill(minres); if(cluSize==2*dupli) hGlobalResClu2R2A->Fill(minres); if(cluSize==3*dupli) hGlobalResClu3R2A->Fill(minres);} 01201 if(rollId.ring()==2&&rollId.roll()==2){if(cluSize==1*dupli) hGlobalResClu1R2B->Fill(minres); if(cluSize==2*dupli) hGlobalResClu2R2B->Fill(minres); if(cluSize==3*dupli) hGlobalResClu3R2B->Fill(minres);} 01202 if(rollId.ring()==2&&rollId.roll()==3){if(cluSize==1*dupli) hGlobalResClu1R2C->Fill(minres); if(cluSize==2*dupli) hGlobalResClu2R2C->Fill(minres); if(cluSize==3*dupli) hGlobalResClu3R2C->Fill(minres);} 01203 if(rollId.ring()==3&&rollId.roll()==1){if(cluSize==1*dupli) hGlobalResClu1R3A->Fill(minres); if(cluSize==2*dupli) hGlobalResClu2R3A->Fill(minres); if(cluSize==3*dupli) hGlobalResClu3R3A->Fill(minres);} 01204 if(rollId.ring()==3&&rollId.roll()==2){if(cluSize==1*dupli) hGlobalResClu1R3B->Fill(minres); if(cluSize==2*dupli) hGlobalResClu2R3B->Fill(minres); if(cluSize==3*dupli) hGlobalResClu3R3B->Fill(minres);} 01205 if(rollId.ring()==3&&rollId.roll()==3){if(cluSize==1*dupli) hGlobalResClu1R3C->Fill(minres); if(cluSize==2*dupli) hGlobalResClu2R3C->Fill(minres); if(cluSize==3*dupli) hGlobalResClu3R3C->Fill(minres);} 01206 } 01207 //------------------------ 01208 sprintf(meIdRPC,"RPCDataOccupancyFromCSC_%s",detUnitLabel); 01209 if(debug) std::cout <<"CSC \t \t \t \t \t \t COINCEDENCE!!! Event="<<iEvent.id()<<"Filling RPC Data Occupancy for "<<meIdRPC<<" with "<<stripPredicted<<std::endl; 01210 meMap[meIdRPC]->Fill(stripPredicted); 01211 } 01212 else{ 01213 RPCGeomServ rpcsrv(rollasociated->id()); 01214 std::string nameRoll = rpcsrv.name(); 01215 if(debug) std::cout<<"CSC \t \t \t \t \t \t A roll was ineficient in event"<<iEvent.id().event()<<std::endl; 01216 if(debug) ofrej<<"CSC \t EndCap "<<rpcRegion 01217 <<"\t cscStation "<<cscStation 01218 <<"\t cscRing "<<cscRing 01219 <<"\t cscChamber "<<cscChamber 01220 <<"\t Roll "<<nameRoll 01221 <<"\t Event "<<iEvent.id().event() 01222 <<"\t CSCId "<<CSCId 01223 <<"\t Event " 01224 <<iEvent.id().event() 01225 <<"\t Run " 01226 <<iEvent.id().run() 01227 <<std::endl; 01228 } 01229 }else{ 01230 if(debug) std::cout<<"CSC \t \t \t \t No the prediction is outside of this roll"<<std::endl; 01231 }//Condition for the right match 01232 }else{//if extrapolation distance D is not too long 01233 if(debug) std::cout<<"CSC \t \t \t No, Exrtrapolation too long!, canceled"<<std::endl; 01234 }//D so big 01235 }//loop over the rolls asociated 01236 }//Condition over the startup geometry!!!! 01237 }//Is the segment 4D? 01238 }else{ 01239 if(debug) std::cout<<"CSC \t \t More than one segment in this chamber, or we are in Station Ring 1 or in Station 4"<<std::endl; 01240 } 01241 } 01242 }else{ 01243 if(debug) std::cout<<"CSC This Event doesn't have any CSCSegment"<<std::endl; 01244 } 01245 } 01246 }
void RPCEfficiency::beginRun | ( | const edm::Run & | run, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 221 of file RPCEfficiency.cc.
References bookDetUnitSeg(), cscGeo, dtGeo, edm::EventSetup::get(), inclcsc, incldt, incldtMB4, it, meCollection, mySegment(), RPCGeomServ::name(), r, RPCDetId::region(), RPCDetId::ring(), RPCChamber::rolls(), rollstoreCSC, rollstoreDT, rpcGeo, RPCDetId::sector(), RPCDetId::station(), and muonGeometry::wheel.
00221 { 00222 00223 iSetup.get<MuonGeometryRecord>().get(rpcGeo); 00224 iSetup.get<MuonGeometryRecord>().get(dtGeo); 00225 iSetup.get<MuonGeometryRecord>().get(cscGeo); 00226 00227 for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){ 00228 if(dynamic_cast< RPCChamber* >( *it ) != 0 ){ 00229 RPCChamber* ch = dynamic_cast< RPCChamber* >( *it ); 00230 std::vector< const RPCRoll*> roles = (ch->rolls()); 00231 for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){ 00232 RPCDetId rpcId = (*r)->id(); 00233 int region=rpcId.region(); 00234 //booking all histograms 00235 RPCGeomServ rpcsrv(rpcId); 00236 std::string nameRoll = rpcsrv.name(); 00237 //std::cout<<"Booking for "<<nameRoll<<std::endl; 00238 meCollection[nameRoll] = bookDetUnitSeg(rpcId,(*r)->nstrips()); 00239 00240 if(region==0&&(incldt||incldtMB4)){ 00241 //std::cout<<"--Filling the dtstore"<<rpcId<<std::endl; 00242 int wheel=rpcId.ring(); 00243 int sector=rpcId.sector(); 00244 int station=rpcId.station(); 00245 DTStationIndex ind(region,wheel,sector,station); 00246 std::set<RPCDetId> myrolls; 00247 if (rollstoreDT.find(ind)!=rollstoreDT.end()) myrolls=rollstoreDT[ind]; 00248 myrolls.insert(rpcId); 00249 rollstoreDT[ind]=myrolls; 00250 00251 } 00252 if(region!=0 && inclcsc){ 00253 //std::cout<<"--Filling the cscstore"<<rpcId<<std::endl; 00254 int region=rpcId.region(); 00255 int station=rpcId.station(); 00256 int ring=rpcId.ring(); 00257 int cscring=ring; 00258 int cscstation=station; 00259 RPCGeomServ rpcsrv(rpcId); 00260 int rpcsegment = mySegment(rpcId); //This replace rpcsrv.segment(); 00261 //std::cout<<"My segment="<<mySegment(rpcId)<<" GeomServ="<<rpcsrv.segment()<<std::endl; 00262 int cscchamber = rpcsegment;//FIX THIS ACCORDING TO RPCGeomServ::segment()Definition 00263 if((station==2||station==3)&&ring==3){//Adding Ring 3 of RPC to the CSC Ring 2 00264 cscring = 2; 00265 } 00266 00267 CSCStationIndex ind(region,cscstation,cscring,cscchamber); 00268 std::set<RPCDetId> myrolls; 00269 if (rollstoreCSC.find(ind)!=rollstoreCSC.end()){ 00270 myrolls=rollstoreCSC[ind]; 00271 } 00272 myrolls.insert(rpcId); 00273 rollstoreCSC[ind]=myrolls; 00274 00275 } 00276 } 00277 } 00278 } 00279 00280 //Now filling in order to extrapolate to other wheels. 00281 /* 00282 for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){ 00283 if( dynamic_cast< RPCChamber* >( *it ) != 0 ){ 00284 00285 RPCChamber* ch = dynamic_cast< RPCChamber* >( *it ); 00286 std::vector< const RPCRoll*> roles = (ch->rolls()); 00287 for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){ 00288 RPCDetId rpcId = (*r)->id(); 00289 00290 int region=rpcId.region(); 00291 00292 if(region==0&&(incldt||incldtMB4)&&rpcId.ring()!=0&&rpcId.station()!=4){ 00293 //std::cout<<"--Filling the dtstore for statistics"<<rpcId<<std::endl; 00294 00295 int sidewheel = 0; 00296 00297 if(rpcId.ring()==-2){ 00298 sidewheel=-1; 00299 } 00300 else if(rpcId.ring()==-1){ 00301 sidewheel=0; 00302 } 00303 else if(rpcId.ring()==1){ 00304 sidewheel=0; 00305 } 00306 else if(rpcId.ring()==2){ 00307 sidewheel=1; 00308 } 00309 int wheel= sidewheel; 00310 int sector=rpcId.sector(); 00311 int station=rpcId.station(); 00312 DTStationIndex ind(region,wheel,sector,station); 00313 std::set<RPCDetId> myrolls; 00314 if (rollstoreDT.find(ind)!=rollstoreDT.end()) myrolls=rollstoreDT[ind]; 00315 myrolls.insert(rpcId); 00316 rollstoreDT[ind]=myrolls; 00317 } 00318 if(region!=0 && inclcsc && (rpcId.ring()==2 || rpcId.ring()==3)){ 00319 int region=rpcId.region(); 00320 int station=rpcId.station(); 00321 int ring=rpcId.ring(); 00322 int sidering = 0; 00323 if(ring==2)sidering =3; 00324 else if(ring==3) sidering =2; 00325 00326 int cscring=sidering; 00327 int cscstation=station; 00328 RPCGeomServ rpcsrv(rpcId); 00329 int rpcsegment = mySegment(rpcId); 00330 00331 if((station==2||station==3)&&ring==3) cscring = 2; //CSC Ring 2 covers rpc ring 2 & 3 00332 00333 int cscchamber = rpcsegment+1; 00334 if(cscchamber==37)cscchamber=1; 00335 CSCStationIndex ind(region,cscstation,cscring,cscchamber); 00336 std::set<RPCDetId> myrolls; 00337 if (rollstoreCSC.find(ind)!=rollstoreCSC.end())myrolls=rollstoreCSC[ind]; 00338 myrolls.insert(rpcId); 00339 rollstoreCSC[ind]=myrolls; 00340 00341 cscchamber = rpcsegment-1; 00342 if(cscchamber==0)cscchamber=36; 00343 CSCStationIndex indDos(region,cscstation,cscring,cscchamber); 00344 std::set<RPCDetId> myrollsDos; 00345 if (rollstoreCSC.find(indDos)!=rollstoreCSC.end())myrollsDos=rollstoreCSC[indDos]; 00346 myrollsDos.insert(rpcId); 00347 rollstoreCSC[indDos]=myrolls; 00348 00349 00350 } 00351 } 00352 } 00353 } 00354 */ 00355 //booking global histograms 00356 00357 00358 }//beginRun
std::map< std::string, MonitorElement * > RPCEfficiency::bookDetUnitSeg | ( | RPCDetId & | detId, | |
int | nstrips | |||
) |
Definition at line 14 of file BookRPCEfficiency.cc.
References DQMStore::book1D(), dbe, RPCBookFolderStructure::folderStructure(), RPCGeomServ::name(), RPCDetId::region(), and DQMStore::setCurrentFolder().
Referenced by beginRun().
00014 { 00015 00016 std::map<std::string, MonitorElement*> meMap; 00017 00018 RPCBookFolderStructure * folderStr = new RPCBookFolderStructure(); //Anna 00019 std::string folder = "Muons/MuonSegEff/" + folderStr->folderStructure(detId); 00020 00021 dbe->setCurrentFolder(folder); 00022 00023 RPCGeomServ RPCname(detId); 00024 std::string nameRoll = RPCname.name(); 00025 00026 char detUnitLabel[128]; 00027 char layerLabel[128]; 00028 00029 sprintf(detUnitLabel ,"%s",nameRoll.c_str()); 00030 sprintf(layerLabel ,"%s",nameRoll.c_str()); 00031 00032 char meId [128]; 00033 char meTitle [128]; 00034 00035 //Begin booking DT 00036 if(detId.region()==0) { 00037 00038 sprintf(meId,"ExpectedOccupancyFromDT_%s",detUnitLabel); 00039 sprintf(meTitle,"ExpectedOccupancyFromDT_for_%s",layerLabel); 00040 meMap[meId] = dbe->book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5); 00041 00042 sprintf(meId,"RealDetectedOccupancyFromDT_%s",detUnitLabel); 00043 sprintf(meTitle,"RealDetectedOccupancyFromDT_for_%s",layerLabel); 00044 meMap[meId] = dbe->book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5); 00045 00046 sprintf(meId,"RPCDataOccupancyFromDT_%s",detUnitLabel); 00047 sprintf(meTitle,"RPCDataOccupancyFromDT_for_%s",layerLabel); 00048 meMap[meId] = dbe->book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5); 00049 00050 sprintf(meId,"BXDistribution_%s",detUnitLabel); 00051 sprintf(meTitle,"BXDistribution_for_%s",layerLabel); 00052 meMap[meId] = dbe->book1D(meId, meTitle, 11,-5.5, 5.5); 00053 }else{ 00054 //std::cout<<"Booking for the EndCap"<<detUnitLabel<<std::endl; 00055 00056 sprintf(meId,"ExpectedOccupancyFromCSC_%s",detUnitLabel); 00057 sprintf(meTitle,"ExpectedOccupancyFromCSC_for_%s",layerLabel); 00058 meMap[meId] = dbe->book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5); 00059 00060 sprintf(meId,"RealDetectedOccupancyFromCSC_%s",detUnitLabel); 00061 sprintf(meTitle,"RealDetectedOccupancyFromCSC_for_%s",layerLabel); 00062 meMap[meId] = dbe->book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5); 00063 00064 sprintf(meId,"RPCDataOccupancyFromCSC_%s",detUnitLabel); 00065 sprintf(meTitle,"RPCDataOccupancyFromCSC_for_%s",layerLabel); 00066 meMap[meId] = dbe->book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5); 00067 00068 sprintf(meId,"BXDistribution_%s",detUnitLabel); 00069 sprintf(meTitle,"BXDistribution_for_%s",layerLabel); 00070 meMap[meId] = dbe->book1D(meId, meTitle, 11,-5.5, 5.5); 00071 } 00072 return meMap; 00073 }
Reimplemented from edm::EDAnalyzer.
Definition at line 1255 of file RPCEfficiency.cc.
References dbe.
01256 { 01257 dbe =0; 01258 }
void RPCEfficiency::endRun | ( | const edm::Run & | r, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 1248 of file RPCEfficiency.cc.
References dbe, EffRootFileName, EffSaveRootFile, and DQMStore::save().
01248 { 01249 if (EffSaveRootFile){ 01250 dbe->save(EffRootFileName); 01251 } 01252 }
std::vector<std::map<RPCDetId, int> > RPCEfficiency::counter [private] |
Definition at line 212 of file RPCEfficiency.h.
std::string RPCEfficiency::cscSegments [private] |
DQMStore* RPCEfficiency::dbe [private] |
Definition at line 239 of file RPCEfficiency.h.
Referenced by bookDetUnitSeg(), endJob(), endRun(), and RPCEfficiency().
bool RPCEfficiency::debug [private] |
std::string RPCEfficiency::dt4DSegments [private] |
int RPCEfficiency::dupli [private] |
std::string RPCEfficiency::EffRootFileName [private] |
bool RPCEfficiency::EffSaveRootFile [private] |
bool RPCEfficiency::inclcsc [private] |
Definition at line 217 of file RPCEfficiency.h.
Referenced by analyze(), beginRun(), and RPCEfficiency().
bool RPCEfficiency::incldt [private] |
Definition at line 215 of file RPCEfficiency.h.
Referenced by analyze(), beginRun(), and RPCEfficiency().
bool RPCEfficiency::incldtMB4 [private] |
Definition at line 216 of file RPCEfficiency.h.
Referenced by analyze(), beginRun(), and RPCEfficiency().
bool RPCEfficiency::inves [private] |
double RPCEfficiency::MaxD [private] |
double RPCEfficiency::MaxDrb4 [private] |
std::map<std::string, std::map<std::string, MonitorElement*> > RPCEfficiency::meCollection [private] |
double RPCEfficiency::MinCosAng [private] |
std::string RPCEfficiency::muonRPCDigis [private] |
std::string RPCEfficiency::nameInLog [private] |
std::ofstream RPCEfficiency::ofrej [private] |
bool RPCEfficiency::paper [private] |
Definition at line 219 of file RPCEfficiency.h.
double RPCEfficiency::rangestrips [private] |
double RPCEfficiency::rangestripsRB4 [private] |
std::string RPCEfficiency::rejected [private] |
Definition at line 230 of file RPCEfficiency.h.
std::string RPCEfficiency::rollseff [private] |
Definition at line 231 of file RPCEfficiency.h.
std::map<CSCStationIndex,std::set<RPCDetId> > RPCEfficiency::rollstoreCSC |
std::map<DTStationIndex,std::set<RPCDetId> > RPCEfficiency::rollstoreDT |
std::vector<int> RPCEfficiency::totalcounter [private] |
Definition at line 213 of file RPCEfficiency.h.