65 modOn( pSet.getUntrackedParameter<bool>(
"modOn",
true) ),
66 ladOn( pSet.getUntrackedParameter<bool>(
"ladOn",
false) ),
67 layOn( pSet.getUntrackedParameter<bool>(
"layOn",
false) ),
68 phiOn( pSet.getUntrackedParameter<bool>(
"phiOn",
false) ),
69 ringOn( pSet.getUntrackedParameter<bool>(
"ringOn",
false) ),
70 bladeOn( pSet.getUntrackedParameter<bool>(
"bladeOn",
false) ),
71 diskOn( pSet.getUntrackedParameter<bool>(
"diskOn",
false) )
81 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource constructor" << endl;
90 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource destructor" << endl;
92 std::map<uint32_t,SiPixelHitEfficiencyModule*>::iterator struct_iter;
94 delete struct_iter->second;
95 struct_iter->second = 0;
100 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource beginJob()" << endl;
105 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource beginRun()" << endl;
111 if (
debug_)
LogVerbatim(
"PixelDQM") <<
"TrackerGeometry "<< &(*TG) <<
" size is "<< TG->dets().size() << endl;
114 for (TrackerGeometry::DetContainer::const_iterator pxb = TG->detsPXB().begin();
115 pxb!=TG->detsPXB().end(); pxb++) {
116 if (dynamic_cast<PixelGeomDetUnit*>((*pxb))!=0) {
121 for (TrackerGeometry::DetContainer::const_iterator pxf = TG->detsPXF().begin();
122 pxf!=TG->detsPXF().end(); pxf++) {
123 if (dynamic_cast<PixelGeomDetUnit*>((*pxf))!=0) {
132 for (std::map<uint32_t, SiPixelHitEfficiencyModule*>::iterator pxd =
theSiPixelStructure.begin();
137 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Folder Creation Failed! ";
141 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource ladder Folder Creation Failed! ";
145 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource layer Folder Creation Failed! ";
149 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource phi Folder Creation Failed! ";
153 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Blade Folder Creation Failed! ";
157 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Disk Folder Creation Failed! ";
161 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Ring Folder Creation Failed! ";
174 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource endJob()";
180 LogInfo(
"PixelDQM") <<
" - saving histograms to "<< outputFile.data();
194 iEvent.
getByLabel(
"offlinePrimaryVertices", vertexCollectionHandle);
195 if(!vertexCollectionHandle.
isValid())
return;
200 reco::VertexCollection::const_iterator bestVtx=vertices.end();
201 for(reco::VertexCollection::const_iterator it=vertices.begin(); it!=vertices.end(); ++it){
202 if(!it->isValid())
continue;
205 (
vtxntrk_==
int(it->tracksSize()) && fabs(
vtxZ_)>fabs(it->z()))){
207 vtxD0_=it->position().rho();
215 if(fabs(it->z())<=20. && fabs(it->position().rho())<=2. && it->ndof()>4)
nvtx_++;
232 std::cout <<
"+++ NEW EVENT +++"<< std::endl;
233 std::cout <<
"Map entries \t : " << ttac.
size() << std::endl;
236 std::set<SiPixelCluster> clusterSet;
245 bool isBpixtrack =
false, isFpixtrack =
false;
246 int nStripHits=0;
int L1hits=0;
int L2hits=0;
int L3hits=0;
int D1hits=0;
int D2hits=0;
247 std::vector<TrajectoryMeasurement> tmeasColl =traj_iterator->measurements();
248 std::vector<TrajectoryMeasurement>::const_iterator tmeasIt;
250 for(tmeasIt = tmeasColl.begin();tmeasIt!=tmeasColl.end();tmeasIt++){
254 uint testSubDetID = (testhit->geographicalId().subdetId());
255 const DetId & hit_detId = testhit->geographicalId();
259 if(layer==1) L1hits++;
260 if(layer==2) L2hits++;
261 if(layer==3) L3hits++;
266 if(disk==1) D1hits++;
267 if(disk==2) D2hits++;
274 if(isBpixtrack || isFpixtrack){
275 if(trackref->pt()<0.6 ||
277 fabs(trackref->dxy(bestVtx->position()))>0.05 ||
278 fabs(trackref->dz(bestVtx->position()))>0.5)
continue;
281 std::cout <<
"isBpixtrack : " << isBpixtrack << std::endl;
282 std::cout <<
"isFpixtrack : " << isFpixtrack << std::endl;
285 for(std::vector<TrajectoryMeasurement>::const_iterator tmeasIt = tmeasColl.begin(); tmeasIt!=tmeasColl.end(); tmeasIt++){
295 const DetId & hit_detId = hit->geographicalId();
297 uint IntSubDetID = (hit_detId.
subdetId());
299 if(IntSubDetID == 0 ){
306 int disk=0;
int layer=0;
int panel=0;
int module=0;
bool isHalfModule=
false;
316 if(fabs(trackref->dxy(bestVtx->position()))>0.01 ||
317 fabs(trackref->dz(bestVtx->position()))>0.1)
continue;
318 if(!(L2hits>0&&L3hits>0) && !(L2hits>0&&D1hits>0) && !(D1hits>0&&D2hits>0))
continue;
320 if(fabs(trackref->dxy(bestVtx->position()))>0.02 ||
321 fabs(trackref->dz(bestVtx->position()))>0.1)
continue;
322 if(!(L1hits>0&&L3hits>0) && !(L1hits>0&&D1hits>0))
continue;
324 if(fabs(trackref->dxy(bestVtx->position()))>0.02 ||
325 fabs(trackref->dz(bestVtx->position()))>0.1)
continue;
326 if(!(L1hits>0&&L2hits>0))
continue;
328 if(fabs(trackref->dxy(bestVtx->position()))>0.05 ||
329 fabs(trackref->dz(bestVtx->position()))>0.5)
continue;
330 if(!(L1hits>0&&D2hits>0) && !(L2hits>0&&D2hits>0))
continue;
332 if(fabs(trackref->dxy(bestVtx->position()))>0.05 ||
333 fabs(trackref->dz(bestVtx->position()))>0.5)
continue;
334 if(!(L1hits>0&&D1hits>0))
continue;
357 if(theGeomDet == 0) {
364 std::map<uint32_t, SiPixelHitEfficiencyModule*>::iterator pxd =
theSiPixelStructure.find((*hit).geographicalId().rawId());
395 if(fabs(lx)>0.55 || fabs(ly)>3.0)
continue;
400 bool passedFiducial=
true;
405 ((module==1 && fabs(ly)<0.7) ||
406 ((module==2 && fabs(ly)<1.1) &&
407 !(disk==-1 && ly>0.8 && lx>0.2) &&
408 !(disk==1 && ly<-0.7 && lx>0.2) &&
409 !(disk==2 && ly<-0.8)) ||
410 ((module==3 && fabs(ly)<1.5) &&
411 !(disk==-2 && lx>0.1 && ly>1.0) &&
412 !(disk==2 && lx>0.1 && ly<-1.0)) ||
413 ((module==4 && fabs(ly)<1.9) &&
414 !(disk==-2 && ly>1.5) &&
415 !(disk==2 && ly<-1.5)))) ||
417 ((module==1 && fabs(ly)<0.7) ||
418 (module==2 && fabs(ly)<1.2 &&
419 !(disk>0 && ly>1.1) &&
420 !(disk<0 && ly<-1.1)) ||
421 (module==3 && fabs(ly)<1.6 &&
422 !(disk>0 && ly>1.5) &&
423 !(disk<0 && ly<-1.5)))))) passedFiducial=
false;
425 ((panel==1 && (module==1 || (module>=3 &&
abs(disk)==1))) ||
426 (panel==2 && ((module==1 &&
abs(disk)==2) ||
427 (module==3 &&
abs(disk)==1))))) passedFiducial=
false;
429 double ly_mod = fabs(ly);
431 float d_rocedge = fabs(fmod(ly_mod,0.81)-0.405);
432 if(d_rocedge<=0.0625) passedFiducial=
false;
434 ((!isHalfModule && fabs(lx)<0.6) ||
435 (isHalfModule && lx>-0.3 && lx<0.2))) ||
438 ((module==1 && fabs(lx)<0.2) ||
440 ((fabs(lx)<0.55 &&
abs(disk)==1) ||
441 (lx>-0.5 && lx<0.2 && disk==-2) ||
442 (lx>-0.5 && lx<0.0 && disk==2))) ||
443 (module==3 && lx>-0.6 && lx<0.5) ||
444 (module==4 && lx>-0.3 && lx<0.15))) ||
446 ((module==1 && fabs(lx)<0.6) ||
448 ((fabs(lx)<0.55 &&
abs(disk)==1) ||
449 (lx>-0.6 && lx<0.5 &&
abs(disk)==2))) ||
450 (module==3 && fabs(lx)<0.5))))))) passedFiducial=
false;
453 fabs(lx)<0.06) passedFiducial=
false;
457 float dx_cl[2];
float dy_cl[2]; dx_cl[0]=dx_cl[1]=dy_cl[0]=dy_cl[1]=-9999.;
467 iEvent.
getByLabel(
"siPixelClusters", clusterCollectionHandle);
468 if(clusterCollectionHandle.
isValid()){
471 float minD[2]; minD[0]=minD[1]=10000.;
472 for( ; itClusterSet!=clusterCollection.
end(); itClusterSet++){
473 DetId detId(itClusterSet->
id());
474 if(detId.rawId()!=hit->geographicalId().rawId())
continue;
478 for( ; itCluster!=itClusterSet->
end(); ++itCluster){
479 LocalPoint lp(itCluster->x(), itCluster->y(), 0.);
482 float D =
sqrt((lp.
x()-lx)*(lp.
x()-lx)+(lp.
y()-ly)*(lp.
y()-ly));
497 for(
size_t i=0;
i<2;
i++){
499 dx_cl[
i]=fabs(dx_cl[
i]-lx);
500 dy_cl[
i]=fabs(dy_cl[
i]-ly);
507 float d_cl[2]; d_cl[0]=d_cl[1]=-9999.;
508 if(dx_cl[0]!=-9999. && dy_cl[0]!=-9999.) d_cl[0]=
sqrt(dx_cl[0]*dx_cl[0]+dy_cl[0]*dy_cl[0]);
509 if(dx_cl[1]!=-9999. && dy_cl[1]!=-9999.) d_cl[1]=
sqrt(dx_cl[1]*dx_cl[1]+dy_cl[1]*dy_cl[1]);
510 if(isHitMissing && (d_cl[0]<0.05 || d_cl[1]<0.05)){ isHitMissing=0; isHitValid=1; }
514 std::cout <<
"Ready to add hit in histogram:\n";
516 std::cout <<
"isHitValid: "<<isHitValid<<std::endl;
517 std::cout <<
"isHitMissing: "<<isHitMissing<<std::endl;
int plaquetteName() const
plaquetteId (in pannel)
T getParameter(std::string const &) const
~SiPixelHitEfficiencySource()
T getUntrackedParameter(std::string const &, T const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
SiPixelHitEfficiencySource(const edm::ParameterSet &)
const LocalTrajectoryParameters & localParameters() const
const_iterator end() const
last iterator over the map (read only)
#define DEFINE_FWK_MODULE(type)
LocalPoint localPosition() const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
std::map< uint32_t, SiPixelHitEfficiencyModule * > theSiPixelStructure
std::vector< Vertex > VertexCollection
collection of Vertex objects
data_type const * const_iterator
id_type id(size_t cell) const
std::pair< LocalPoint, LocalError > LocalValues
virtual LocalValues localParameters(const T &, const GeomDetUnit &) const =0
virtual void endJob(void)
bool isHalfModule() const
full or half module
virtual void beginRun(const edm::Run &r, edm::EventSetup const &iSetup)
const_iterator end() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
virtual const GeomDet * idToDet(DetId) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
DecomposeProduct< arg, typename Div::arg > D
size_type size() const
map size
key_type key() const
Accessor for product key.
int layerName() const
layer id
T const * product() const
T const * product() const
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
int pannelName() const
pannel id
int diskName() const
disk id
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
const_iterator begin() const
first iterator over the map (read only)
bool setModuleFolder(const uint32_t &rawdetid=0, int type=0)
Set folder name for a module or plaquette.