00001 #include <FWCore/MessageLogger/interface/MessageLogger.h>
00002
00003 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00004 #include "Geometry/TrackerGeometryBuilder/interface/GluedGeomDet.h"
00005
00006 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
00007 #include "DataFormats/DetId/interface/DetId.h"
00008 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00009 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00010 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00011 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00012 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00013 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
00014 #include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h"
00015 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h"
00016 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00017
00018 #include "DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h"
00019
00020 #include "DQM/SiStripCommon/interface/SiStripHistoId.h"
00021 #include "TMath.h"
00022
00023 static const uint16_t _NUM_SISTRIP_SUBDET_ = 4;
00024 static TString SubDet[_NUM_SISTRIP_SUBDET_]={"TIB","TID","TOB","TEC"};
00025 static std::string flags[2] = {"OnTrack","OffTrack"};
00026
00027 SiStripMonitorTrack::SiStripMonitorTrack(const edm::ParameterSet& conf):
00028 dbe(edm::Service<DQMStore>().operator->()),
00029 conf_(conf),
00030 Cluster_src_( conf.getParameter<edm::InputTag>( "Cluster_src" ) ),
00031 Mod_On_(conf.getParameter<bool>("Mod_On")),
00032 Trend_On_(conf.getParameter<bool>("Trend_On")),
00033 OffHisto_On_(conf.getParameter<bool>("OffHisto_On")),
00034 RawDigis_On_(conf.getParameter<bool>("RawDigis_On")),
00035 CCAnalysis_On_(conf.getParameter<bool>("CCAnalysis_On")),
00036 folder_organizer(), tracksCollection_in_EventTree(true),
00037 flag_ring(conf.getParameter<bool>("RingFlag_On")),
00038 firstEvent(-1)
00039 {
00040 for(int i=0;i<4;++i) for(int j=0;j<2;++j) NClus[i][j]=0;
00041 if(OffHisto_On_){
00042 off_Flag = 2;
00043 }else{
00044 off_Flag = 1;
00045 }
00046 }
00047
00048
00049 SiStripMonitorTrack::~SiStripMonitorTrack() { }
00050
00051
00052
00053
00054 void SiStripMonitorTrack::beginRun(const edm::Run& run,const edm::EventSetup& es)
00055 {
00056
00057 es.get<TrackerDigiGeometryRecord>().get( tkgeom );
00058 edm::LogInfo("SiStripMonitorTrack") << "[SiStripMonitorTrack::beginRun] There are "<<tkgeom->detUnits().size() <<" detectors instantiated in the geometry" << std::endl;
00059 es.get<SiStripDetCablingRcd>().get( SiStripDetCabling_ );
00060
00061 book();
00062 }
00063
00064
00065 void SiStripMonitorTrack::endJob(void)
00066 {
00067 if(conf_.getParameter<bool>("OutputMEsInRootFile")){
00068 dbe->showDirStructure();
00069 dbe->save(conf_.getParameter<std::string>("OutputFileName"));
00070 }
00071 }
00072
00073
00074 void SiStripMonitorTrack::analyze(const edm::Event& e, const edm::EventSetup& es)
00075 {
00076
00077 tracksCollection_in_EventTree=true;
00078 trackAssociatorCollection_in_EventTree=true;
00079
00080
00081 edm::LogInfo("SiStripMonitorTrack") << "[SiStripMonitorTrack::analyse] " << "Run " << e.id().run() << " Event " << e.id().event() << std::endl;
00082 runNb = e.id().run();
00083 eventNb = e.id().event();
00084 vPSiStripCluster.clear();
00085 countOn=0;
00086 countOff=0;
00087
00088 e.getByLabel( Cluster_src_, dsv_SiStripCluster);
00089
00090
00091 std::string TrackProducer = conf_.getParameter<std::string>("TrackProducer");
00092 std::string TrackLabel = conf_.getParameter<std::string>("TrackLabel");
00093
00094 e.getByLabel(TrackProducer, TrackLabel, trackCollection);
00095
00096 if (trackCollection.isValid()){
00097 }else{
00098 edm::LogError("SiStripMonitorTrack")<<" Track Collection is not valid !! " << TrackLabel<<std::endl;
00099 tracksCollection_in_EventTree=false;
00100 }
00101
00102
00103 if(RawDigis_On_) {
00104 std::string digiProducer = conf_.getParameter<std::string>("RawDigiProducer");
00105 std::string digiLabel = conf_.getParameter<std::string>("RawDigiLabel");
00106 e.getByLabel(digiProducer,digiLabel,dsv_SiStripRawDigi);
00107 if( ! dsv_SiStripRawDigi.failedToGet() ){
00108
00109 edm::LogInfo("SiStripMonitorTrack") << "[SiStripMonitorTrack::analyse] " << "Digi " << digiLabel
00110 << " found " << dsv_SiStripRawDigi->size() << "\n";
00111
00112
00113
00114
00115
00116 }else{
00117 LogDebug("SiStripMonitorTrack") << "RawDigis not found " << std::endl;
00118 }
00119 } else {
00120 LogDebug("SiStripMonitorTrack") << "RawDigis Off " << std::endl;
00121 }
00122
00123
00124 e.getByLabel(TrackProducer, TrackLabel, TrajectoryCollection);
00125 e.getByLabel(TrackProducer, TrackLabel, TItkAssociatorCollection);
00126 if( TItkAssociatorCollection.isValid()){
00127 }else{
00128 edm::LogError("SiStripMonitorTrack")<<"Association not found "<<std::endl;
00129 trackAssociatorCollection_in_EventTree=false;
00130 }
00131
00132
00133 if (tracksCollection_in_EventTree && trackAssociatorCollection_in_EventTree) trackStudy(es);
00134
00135
00136
00137 if(OffHisto_On_){
00138 if (dsv_SiStripCluster.isValid()){
00139 AllClusters(es);
00140 }else{
00141 edm::LogError("SiStripMonitorTrack")<< "ClusterCollection is not valid!!" << std::endl;
00142 }
00143 }
00144
00145
00146 std::map<TString, MonitorElement*>::iterator iME;
00147 std::map<TString, ModMEs>::iterator iModME ;
00148 std::map<TString, LayerMEs>::iterator iLayerME;
00149
00150 for (int j=0;j<off_Flag;++j){
00151 int nTot=0;
00152 for (int i=0;i<4;++i){
00153 name=flags[j]+"_in_"+SubDet[i];
00154 iLayerME = LayerMEsMap.find(name);
00155 if(iLayerME!=LayerMEsMap.end()) {
00156 if(flags[j]=="OnTrack" && NClus[i][j]){
00157 fillME( iLayerME->second.nClusters, NClus[i][j]);
00158 }else if(flags[j]=="OffTrack"){
00159 fillME( iLayerME->second.nClusters, NClus[i][j]);
00160 }
00161 if(Trend_On_)
00162 fillTrend(iLayerME->second.nClustersTrend, NClus[i][j]);
00163 }
00164 nTot+=NClus[i][j];
00165 NClus[i][j]=0;
00166 }
00167
00168 name=flags[j]+"_TotalNumberOfClusters";
00169 iME = MEMap.find(name);
00170 if(iME!=MEMap.end() && nTot) iME->second->Fill(nTot);
00171 if(Trend_On_){
00172 iME = MEMap.find(name+"Trend");
00173 if(iME!=MEMap.end()) fillTrend(iME->second,nTot);
00174 }
00175 }
00176
00177 }
00178
00179
00180 void SiStripMonitorTrack::book()
00181 {
00182
00183 std::vector<uint32_t> vdetId_;
00184 SiStripDetCabling_->addActiveDetectorsRawIds(vdetId_);
00185
00186 for (std::vector<uint32_t>::const_iterator detid_iter=vdetId_.begin();detid_iter!=vdetId_.end();detid_iter++){
00187 uint32_t detid = *detid_iter;
00188
00189 if (detid < 1){
00190 edm::LogError("SiStripMonitorTrack")<< "[" <<__PRETTY_FUNCTION__ << "] invalid detid " << detid<< std::endl;
00191 continue;
00192 }
00193
00194
00195 std::string MEFolderName = conf_.getParameter<std::string>("FolderName");
00196 dbe->setCurrentFolder(MEFolderName);
00197
00198 for (int j=0;j<off_Flag;j++) {
00199 name=flags[j]+"_TotalNumberOfClusters";
00200 if(MEMap.find(name)==MEMap.end()) {
00201 if(flags[j] == "OnTrack"){
00202 MEMap[name]=bookME1D("TH1nClustersOn", name.Data());
00203 }else{
00204 MEMap[name]=bookME1D("TH1nClustersOff", name.Data());
00205 }
00206 if(Trend_On_){
00207 name+="Trend";
00208 if(flags[j] == "OnTrack"){
00209 MEMap[name]=bookMETrend("TH1nClustersOn", name.Data());
00210 }else{
00211 MEMap[name]=bookMETrend("TH1nClustersOff", name.Data());
00212 }
00213 }
00214 }
00215 }
00216
00217
00218
00219
00220
00221
00222
00223 if (DetectedLayers.find(folder_organizer.GetSubDetAndLayer(detid,flag_ring)) == DetectedLayers.end()){
00224
00225 DetectedLayers[folder_organizer.GetSubDetAndLayer(detid,flag_ring)]=true;
00226 for (int j=0;j<off_Flag;j++){
00227 folder_organizer.setLayerFolder(*detid_iter,folder_organizer.GetSubDetAndLayer(*detid_iter,flag_ring).second,flag_ring);
00228 bookTrendMEs("layer",(folder_organizer.GetSubDetAndLayer(*detid_iter,flag_ring)).second,*detid_iter,flags[j]);
00229 }
00230 }
00231
00232 if(Mod_On_){
00233
00234 folder_organizer.setDetectorFolder(*detid_iter);
00235 bookModMEs("det",*detid_iter);
00236 }
00237
00238 DetectedLayers[folder_organizer.GetSubDetAndLayer(*detid_iter,flag_ring)] |= (DetectedLayers.find(folder_organizer.GetSubDetAndLayer(*detid_iter,flag_ring)) == DetectedLayers.end());
00239 }
00240
00241
00242 for (std::map<std::pair<std::string,int32_t>,bool>::const_iterator iter=DetectedLayers.begin(); iter!=DetectedLayers.end();iter++){
00243 for (int j=0;j<off_Flag;j++){
00244 folder_organizer.setDetectorFolder(0);
00245 dbe->cd("SiStrip/MechanicalView/"+iter->first.first);
00246 name=flags[j]+"_in_"+iter->first.first;
00247 bookSubDetMEs(name,flags[j]);
00248 }
00249 }
00250
00251 }
00252
00253
00254 void SiStripMonitorTrack::bookModMEs(TString name, uint32_t id)
00255 {
00256 SiStripHistoId hidmanager;
00257 std::string hid = hidmanager.createHistoId("",name.Data(),id);
00258 std::map<TString, ModMEs>::iterator iModME = ModMEsMap.find(TString(hid));
00259 if(iModME==ModMEsMap.end()){
00260 ModMEs theModMEs;
00261
00262 theModMEs.ClusterWidth=bookME1D("TH1ClusterWidth", hidmanager.createHistoId("ClusterWidth_OnTrack",name.Data(),id).c_str());
00263 dbe->tag(theModMEs.ClusterWidth,id);
00264
00265 theModMEs.ClusterCharge=bookME1D("TH1ClusterCharge", hidmanager.createHistoId("ClusterCharge_OnTrack",name.Data(),id).c_str());
00266 dbe->tag(theModMEs.ClusterCharge,id);
00267
00268 theModMEs.ClusterStoN=bookME1D("TH1ClusterStoN", hidmanager.createHistoId("ClusterStoN_OnTrack",name.Data(),id).c_str());
00269 dbe->tag(theModMEs.ClusterStoN,id);
00270
00271 theModMEs.ClusterChargeCorr=bookME1D("TH1ClusterChargeCorr", hidmanager.createHistoId("ClusterChargeCorr_OnTrack",name.Data(),id).c_str());
00272 dbe->tag(theModMEs.ClusterChargeCorr,id);
00273
00274 theModMEs.ClusterStoNCorr=bookME1D("TH1ClusterStoNCorr", hidmanager.createHistoId("ClusterStoNCorr_OnTrack",name.Data(),id).c_str());
00275 dbe->tag(theModMEs.ClusterStoNCorr,id);
00276
00277 short total_nr_strips = SiStripDetCabling_->nApvPairs(id) * 2 * 128;
00278 theModMEs.ClusterPos=dbe->book1D(hidmanager.createHistoId("ClusterPosition_OnTrack",name.Data(),id).c_str(),hidmanager.createHistoId("ClusterPosition_OnTrack",name.Data(),id).c_str(),total_nr_strips,0.5,total_nr_strips+0.5);
00279 dbe->tag(theModMEs.ClusterPos,id);
00280
00281 theModMEs.ClusterPGV=bookMEProfile("TProfileClusterPGV", hidmanager.createHistoId("PGV_OnTrack",name.Data(),id).c_str());
00282 dbe->tag(theModMEs.ClusterPGV,id);
00283
00284
00285
00286
00287 ModMEsMap[hid]=theModMEs;
00288 }
00289 }
00290
00291 void SiStripMonitorTrack::bookTrendMEs(TString name,int32_t layer,uint32_t id,std::string flag)
00292 {
00293 char rest[1024];
00294 int subdetid = ((id>>25)&0x7);
00295 if( subdetid==3 ){
00296
00297 TIBDetId tib1 = TIBDetId(id);
00298 sprintf(rest,"TIB__layer__%d",tib1.layer());
00299 }else if( subdetid==4){
00300
00301 TIDDetId tid1 = TIDDetId(id);
00302 sprintf(rest,"TID__side__%d__wheel__%d",tid1.side(),tid1.wheel());
00303 }else if( subdetid==5){
00304
00305 TOBDetId tob1 = TOBDetId(id);
00306 sprintf(rest,"TOB__layer__%d",tob1.layer());
00307 }else if( subdetid==6){
00308
00309 TECDetId tec1 = TECDetId(id);
00310 sprintf(rest,"TEC__side__%d__wheel__%d",tec1.side(),tec1.wheel());
00311 }else{
00312
00313 edm::LogError("SiStripTkDQM|WrongInput")<<"no such subdetector type :"<<subdetid<<" no folder set!"<<std::endl;
00314 return;
00315 }
00316
00317 if(flag_ring){
00318 if( subdetid==4){
00319
00320 TIDDetId tid1 = TIDDetId(id);
00321 sprintf(rest,"TID__side__%d__ring__%d",tid1.side(),tid1.ring());
00322 }else if( subdetid==6){
00323
00324 TECDetId tec1 = TECDetId(id);
00325 sprintf(rest,"TEC__side__%d__ring__%d",tec1.side(),tec1.ring());
00326 }
00327 }
00328
00329
00330 SiStripHistoId hidmanager;
00331 std::string hid = hidmanager.createHistoLayer("",name.Data(),rest,flag);
00332 std::map<TString, LayerMEs>::iterator iLayerME = LayerMEsMap.find(TString(hid));
00333 if(iLayerME==LayerMEsMap.end()){
00334 LayerMEs theLayerMEs;
00335
00336
00337 theLayerMEs.ClusterWidth=bookME1D("TH1ClusterWidth", hidmanager.createHistoLayer("Summary_ClusterWidth",name.Data(),rest,flag).c_str());
00338 dbe->tag(theLayerMEs.ClusterWidth,layer);
00339
00340
00341 theLayerMEs.ClusterNoise=bookME1D("TH1ClusterNoise", hidmanager.createHistoLayer("Summary_ClusterNoise",name.Data(),rest,flag).c_str());
00342 dbe->tag(theLayerMEs.ClusterNoise,layer);
00343
00344
00345 theLayerMEs.ClusterCharge=bookME1D("TH1ClusterCharge", hidmanager.createHistoLayer("Summary_ClusterCharge",name.Data(),rest,flag).c_str());
00346 dbe->tag(theLayerMEs.ClusterCharge,layer);
00347
00348
00349 theLayerMEs.ClusterStoN=bookME1D("TH1ClusterStoN", hidmanager.createHistoLayer("Summary_ClusterStoN",name.Data(),rest,flag).c_str());
00350 dbe->tag(theLayerMEs.ClusterStoN,layer);
00351
00352
00353 if(Trend_On_){
00354
00355 theLayerMEs.ClusterWidthTrend=bookMETrend("TH1ClusterWidth", hidmanager.createHistoLayer("Trend_ClusterWidth",name.Data(),rest,flag).c_str());
00356 dbe->tag(theLayerMEs.ClusterWidthTrend,layer);
00357
00358 theLayerMEs.ClusterNoiseTrend=bookMETrend("TH1ClusterNoise", hidmanager.createHistoLayer("Trend_ClusterNoise",name.Data(),rest,flag).c_str());
00359 dbe->tag(theLayerMEs.ClusterNoiseTrend,layer);
00360
00361 theLayerMEs.ClusterChargeTrend=bookMETrend("TH1ClusterCharge", hidmanager.createHistoLayer("Trend_ClusterCharge",name.Data(),rest,flag).c_str());
00362 dbe->tag(theLayerMEs.ClusterChargeTrend,layer);
00363
00364 theLayerMEs.ClusterStoNTrend=bookMETrend("TH1ClusterStoN", hidmanager.createHistoLayer("Trend_ClusterStoN",name.Data(),rest,flag).c_str());
00365 dbe->tag(theLayerMEs.ClusterStoNTrend,layer);
00366 }
00367
00368 if(flag=="OnTrack"){
00369
00370 theLayerMEs.ClusterChargeCorr=bookME1D("TH1ClusterChargeCorr", hidmanager.createHistoLayer("Summary_ClusterChargeCorr",name.Data(),rest,flag).c_str());
00371 dbe->tag(theLayerMEs.ClusterChargeCorr,layer);
00372
00373 theLayerMEs.ClusterStoNCorr=bookME1D("TH1ClusterStoNCorr", hidmanager.createHistoLayer("Summary_ClusterStoNCorr",name.Data(),rest,flag).c_str());
00374 dbe->tag(theLayerMEs.ClusterStoNCorr,layer);
00375
00376 theLayerMEs.ClusterSymmEtaCC=bookME1D("TH1ClusterSymmEtaCC", hidmanager.createHistoLayer("Summary_ClusterSymmEtaCC",name.Data(),rest,flag).c_str());
00377 dbe->tag(theLayerMEs.ClusterSymmEtaCC,layer);
00378
00379
00380 if(CCAnalysis_On_) {
00381
00382 theLayerMEs.ClusterWidthCC=bookME1D("TH1ClusterWidthCC", hidmanager.createHistoLayer("Summary_ClusterWidthCC",name.Data(),rest,flag).c_str());
00383 dbe->tag(theLayerMEs.ClusterWidthCC,layer);
00384
00385 theLayerMEs.ClusterEstimatorCC=bookME1D("TH1ClusterEstimatorCC", hidmanager.createHistoLayer("Summary_ClusterEstimatorCC",name.Data(),rest,flag).c_str());
00386 dbe->tag(theLayerMEs.ClusterEstimatorCC,layer);
00387 }
00388
00389 if(Trend_On_){
00390
00391 theLayerMEs.ClusterChargeCorrTrend=bookMETrend("TH1ClusterChargeCorr", hidmanager.createHistoLayer("Trend_ClusterChargeCorr",name.Data(),rest,flag).c_str());
00392 dbe->tag(theLayerMEs.ClusterChargeCorrTrend,layer);
00393
00394
00395 theLayerMEs.ClusterStoNCorrTrend=bookMETrend("TH1ClusterStoNCorr", hidmanager.createHistoLayer("Trend_ClusterStoNCorr",name.Data(),rest,flag).c_str());
00396 dbe->tag(theLayerMEs.ClusterStoNCorrTrend,layer);
00397
00398
00399 theLayerMEs.ClusterSymmEtaCCTrend=bookMETrend("TH1ClusterSymmEtaCC", hidmanager.createHistoLayer("Trend_ClusterSymmEtaCC",name.Data(),rest,flag).c_str());
00400 dbe->tag(theLayerMEs.ClusterSymmEtaCCTrend,layer);
00401 }
00402
00403 }
00404
00405
00406 short total_nr_strips = SiStripDetCabling_->nApvPairs(id) * 2 * 128;
00407 theLayerMEs.ClusterPos= dbe->book1D(hidmanager.createHistoLayer("Summary_ClusterPosition",name.Data(),rest,flag).c_str(),hidmanager.createHistoLayer("Summary_ClusterPosition",name.Data(),rest,flag).c_str(),total_nr_strips, 0.5,total_nr_strips+0.5);
00408 dbe->tag(theLayerMEs.ClusterPos,layer);
00409
00410
00411 LayerMEsMap[hid]=theLayerMEs;
00412 }
00413
00414 }
00415
00416 void SiStripMonitorTrack::bookSubDetMEs(TString name,TString flag)
00417 {
00418 std::map<TString, LayerMEs>::iterator iLayerME = LayerMEsMap.find(name);
00419 char completeName[1024];
00420 if(iLayerME==LayerMEsMap.end()){
00421 LayerMEs theLayerMEs;
00422
00423
00424
00425 if (flag=="OnTrack"){
00426 sprintf(completeName,"Summary_TotalNumberOfClusters_%s",name.Data());
00427 theLayerMEs.nClusters=bookME1D("TH1nClustersOn", completeName);
00428 theLayerMEs.nClusters->getTH1()->StatOverflows(kTRUE);
00429 }else{
00430 sprintf(completeName,"Summary_TotalNumberOfClusters_%s",name.Data());
00431 theLayerMEs.nClusters=bookME1D("TH1nClustersOff", completeName);
00432 theLayerMEs.nClusters->getTH1()->StatOverflows(kTRUE);
00433 }
00434
00435
00436 sprintf(completeName,"Summary_ClusterWidth_%s",name.Data());
00437 theLayerMEs.ClusterWidth=bookME1D("TH1ClusterWidth", completeName);
00438
00439
00440 sprintf(completeName,"Summary_ClusterNoise_%s",name.Data());
00441 theLayerMEs.ClusterNoise=bookME1D("TH1ClusterNoise", completeName);
00442
00443
00444 sprintf(completeName,"Summary_ClusterCharge_%s",name.Data());
00445 theLayerMEs.ClusterCharge=bookME1D("TH1ClusterCharge", completeName);
00446
00447
00448 sprintf(completeName,"Summary_ClusterStoN_%s",name.Data());
00449 theLayerMEs.ClusterStoN=bookME1D("TH1ClusterStoN", completeName);
00450
00451
00452 if(Trend_On_){
00453 if (flag=="OnTrack"){
00454
00455 sprintf(completeName,"Trend_TotalNumberOfClusters_%s",name.Data());
00456 theLayerMEs.nClustersTrend=bookMETrend("TH1nClustersOn", completeName);
00457 }else{
00458 sprintf(completeName,"Trend_TotalNumberOfClusters_%s",name.Data());
00459 theLayerMEs.nClustersTrend=bookMETrend("TH1nClustersOff", completeName);
00460 }
00461
00462 sprintf(completeName,"Trend_ClusterWidth_%s",name.Data());
00463 theLayerMEs.ClusterWidthTrend=bookMETrend("TH1ClusterWidth", completeName);
00464
00465 sprintf(completeName,"Trend_ClusterNoise_%s",name.Data());
00466 theLayerMEs.ClusterNoiseTrend=bookMETrend("TH1ClusterNoise", completeName);
00467
00468 sprintf(completeName,"Trend_ClusterCharge_%s",name.Data());
00469 theLayerMEs.ClusterChargeTrend=bookMETrend("TH1ClusterCharge", completeName);
00470
00471 sprintf(completeName,"Trend_ClusterStoN_%s",name.Data());
00472 theLayerMEs.ClusterStoNTrend=bookMETrend("TH1ClusterStoN", completeName);
00473 }
00474
00475 if (flag=="OnTrack"){
00476
00477 sprintf(completeName,"Summary_ClusterStoNCorr_%s",name.Data());
00478 theLayerMEs.ClusterStoNCorr=bookME1D("TH1ClusterStoNCorr", completeName);
00479
00480
00481 sprintf(completeName,"Summary_ClusterChargeCorr_%s",name.Data());
00482 theLayerMEs.ClusterChargeCorr=bookME1D("TH1ClusterChargeCorr", completeName);
00483
00484
00485 sprintf(completeName,"Summary_ClusterSymmEtaCC_%s",name.Data());
00486 theLayerMEs.ClusterSymmEtaCC=bookME1D("TH1ClusterSymmEtaCC", completeName);
00487
00488
00489 if(CCAnalysis_On_) {
00490
00491 sprintf(completeName,"Summary_ClusterWidthCC_%s",name.Data());
00492 theLayerMEs.ClusterWidthCC=bookME1D("TH1ClusterWidthCC", completeName);
00493
00494 sprintf(completeName,"Summary_ClusterEstimatorCC_%s",name.Data());
00495 theLayerMEs.ClusterEstimatorCC=bookME1D("TH1ClusterEstimatorCC", completeName);
00496 }
00497
00498 if(Trend_On_){
00499
00500 sprintf(completeName,"Trend_ClusterStoNCorr_%s",name.Data());
00501 theLayerMEs.ClusterStoNCorrTrend=bookMETrend("TH1ClusterStoNCorr", completeName);
00502
00503 sprintf(completeName,"Trend_ClusterChargeCorr_%s",name.Data());
00504 theLayerMEs.ClusterChargeCorrTrend=bookMETrend("TH1ClusterChargeCorr", completeName);
00505
00506 sprintf(completeName,"Trend_ClusterSymmEtaCC_%s",name.Data());
00507 theLayerMEs.ClusterSymmEtaCCTrend=bookMETrend("TH1ClusterSymmEtaCC", completeName);
00508
00509
00510 }
00511 }
00512
00513
00514 LayerMEsMap[name]=theLayerMEs;
00515 }
00516 }
00517
00518
00519 MonitorElement* SiStripMonitorTrack::bookME1D(const char* ParameterSetLabel, const char* HistoName)
00520 {
00521 Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
00522 return dbe->book1D(HistoName,HistoName,
00523 Parameters.getParameter<int32_t>("Nbinx"),
00524 Parameters.getParameter<double>("xmin"),
00525 Parameters.getParameter<double>("xmax")
00526 );
00527 }
00528
00529
00530 MonitorElement* SiStripMonitorTrack::bookME2D(const char* ParameterSetLabel, const char* HistoName)
00531 {
00532 Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
00533 return dbe->book2D(HistoName,HistoName,
00534 Parameters.getParameter<int32_t>("Nbinx"),
00535 Parameters.getParameter<double>("xmin"),
00536 Parameters.getParameter<double>("xmax"),
00537 Parameters.getParameter<int32_t>("Nbiny"),
00538 Parameters.getParameter<double>("ymin"),
00539 Parameters.getParameter<double>("ymax")
00540 );
00541 }
00542
00543
00544 MonitorElement* SiStripMonitorTrack::bookME3D(const char* ParameterSetLabel, const char* HistoName)
00545 {
00546 Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
00547 return dbe->book3D(HistoName,HistoName,
00548 Parameters.getParameter<int32_t>("Nbinx"),
00549 Parameters.getParameter<double>("xmin"),
00550 Parameters.getParameter<double>("xmax"),
00551 Parameters.getParameter<int32_t>("Nbiny"),
00552 Parameters.getParameter<double>("ymin"),
00553 Parameters.getParameter<double>("ymax"),
00554 Parameters.getParameter<int32_t>("Nbinz"),
00555 Parameters.getParameter<double>("zmin"),
00556 Parameters.getParameter<double>("zmax")
00557 );
00558 }
00559
00560
00561 MonitorElement* SiStripMonitorTrack::bookMEProfile(const char* ParameterSetLabel, const char* HistoName)
00562 {
00563 Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
00564 return dbe->bookProfile(HistoName,HistoName,
00565 Parameters.getParameter<int32_t>("Nbinx"),
00566 Parameters.getParameter<double>("xmin"),
00567 Parameters.getParameter<double>("xmax"),
00568 Parameters.getParameter<int32_t>("Nbiny"),
00569 Parameters.getParameter<double>("ymin"),
00570 Parameters.getParameter<double>("ymax"),
00571 "" );
00572 }
00573
00574
00575 MonitorElement* SiStripMonitorTrack::bookMETrend(const char* ParameterSetLabel, const char* HistoName)
00576 {
00577 Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
00578 edm::ParameterSet ParametersTrend = conf_.getParameter<edm::ParameterSet>("Trending");
00579 MonitorElement* me = dbe->bookProfile(HistoName,HistoName,
00580 ParametersTrend.getParameter<int32_t>("Nbins"),
00581 0,
00582 ParametersTrend.getParameter<int32_t>("Nbins"),
00583 100,
00584 Parameters.getParameter<double>("xmin"),
00585 Parameters.getParameter<double>("xmax"),
00586 "" );
00587 if(!me) return me;
00588 char buffer[256];
00589 sprintf(buffer,"EventId/%d",ParametersTrend.getParameter<int32_t>("Steps"));
00590 me->setAxisTitle(std::string(buffer),1);
00591 return me;
00592 }
00593
00594
00595 void SiStripMonitorTrack::trackStudy(const edm::EventSetup& es)
00596 {
00597
00598 const reco::TrackCollection tC = *(trackCollection.product());
00599 int i=0;
00600 std::vector<TrajectoryMeasurement> measurements;
00601 for(TrajTrackAssociationCollection::const_iterator it = TItkAssociatorCollection->begin();it != TItkAssociatorCollection->end(); ++it){
00602 const edm::Ref<std::vector<Trajectory> > traj_iterator = it->key;
00603
00604 reco::TrackRef trackref = it->val;
00605 LogTrace("SiStripMonitorTrack")
00606 << "Track number "<< i+1
00607 << "\n\tmomentum: " << trackref->momentum()
00608 << "\n\tPT: " << trackref->pt()
00609 << "\n\tvertex: " << trackref->vertex()
00610 << "\n\timpact parameter: " << trackref->d0()
00611 << "\n\tcharge: " << trackref->charge()
00612 << "\n\tnormalizedChi2: " << trackref->normalizedChi2()
00613 <<"\n\tFrom EXTRA : "
00614 <<"\n\t\touter PT "<< trackref->outerPt()<<std::endl;
00615 i++;
00616
00617 measurements =traj_iterator->measurements();
00618 std::vector<TrajectoryMeasurement>::iterator traj_mes_iterator;
00619 int nhit=0;
00620 for(traj_mes_iterator=measurements.begin();traj_mes_iterator!=measurements.end();traj_mes_iterator++){
00621
00622 LocalPoint stateposition;
00623 LocalVector statedirection;
00624
00625 TrajectoryStateOnSurface updatedtsos=traj_mes_iterator->updatedState();
00626 ConstRecHitPointer ttrh=traj_mes_iterator->recHit();
00627 if (!ttrh->isValid()) {continue;}
00628
00629 std::stringstream ss;
00630
00631 nhit++;
00632
00633 const ProjectedSiStripRecHit2D* phit=dynamic_cast<const ProjectedSiStripRecHit2D*>( ttrh->hit() );
00634 const SiStripMatchedRecHit2D* matchedhit=dynamic_cast<const SiStripMatchedRecHit2D*>( ttrh->hit() );
00635 const SiStripRecHit2D* hit=dynamic_cast<const SiStripRecHit2D*>( ttrh->hit() );
00636
00637 RecHitType type=Single;
00638
00639 if(matchedhit){
00640 LogTrace("SiStripMonitorTrack")<<"\nMatched recHit found"<< std::endl;
00641 type=Matched;
00642
00643 GluedGeomDet * gdet=(GluedGeomDet *)tkgeom->idToDet(matchedhit->geographicalId());
00644 GlobalVector gtrkdirup=gdet->toGlobal(updatedtsos.localMomentum());
00645
00646 const GeomDetUnit * monodet=gdet->monoDet();
00647 statedirection=monodet->toLocal(gtrkdirup);
00648 if(statedirection.mag() != 0) RecHitInfo(matchedhit->monoHit(),statedirection,trackref,es);
00649
00650 const GeomDetUnit * stereodet=gdet->stereoDet();
00651 statedirection=stereodet->toLocal(gtrkdirup);
00652 if(statedirection.mag() != 0) RecHitInfo(matchedhit->stereoHit(),statedirection,trackref,es);
00653 ss<<"\nLocalMomentum (stereo): " << statedirection;
00654 }
00655 else if(phit){
00656 LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found"<< std::endl;
00657 type=Projected;
00658 GluedGeomDet * gdet=(GluedGeomDet *)tkgeom->idToDet(phit->geographicalId());
00659
00660 GlobalVector gtrkdirup=gdet->toGlobal(updatedtsos.localMomentum());
00661 const SiStripRecHit2D& originalhit=phit->originalHit();
00662 const GeomDetUnit * det;
00663 if(!StripSubdetector(originalhit.geographicalId().rawId()).stereo()){
00664
00665 LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found MONO"<< std::endl;
00666 det=gdet->monoDet();
00667 statedirection=det->toLocal(gtrkdirup);
00668 if(statedirection.mag() != 0) RecHitInfo(&(phit->originalHit()),statedirection,trackref,es);
00669 }
00670 else{
00671 LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found STEREO"<< std::endl;
00672
00673 det=gdet->stereoDet();
00674 statedirection=det->toLocal(gtrkdirup);
00675 if(statedirection.mag() != 0) RecHitInfo(&(phit->originalHit()),statedirection,trackref,es);
00676 }
00677 }else {
00678 if(hit!=0){
00679 ss<<"\nSingle recHit found"<< std::endl;
00680 statedirection=updatedtsos.localMomentum();
00681 if(statedirection.mag() != 0) RecHitInfo(hit,statedirection,trackref,es);
00682 }
00683 }
00684 ss <<"LocalMomentum: "<<statedirection
00685 << "\nLocal x-z plane angle: "<<atan2(statedirection.x(),statedirection.z());
00686 LogTrace("SiStripMonitorTrack") <<ss.str() << std::endl;
00687 }
00688
00689 }
00690 }
00691
00692 void SiStripMonitorTrack::RecHitInfo(const SiStripRecHit2D* tkrecHit, LocalVector LV,reco::TrackRef track_ref, const edm::EventSetup& es){
00693
00694 if(!tkrecHit->isValid()){
00695 LogTrace("SiStripMonitorTrack") <<"\t\t Invalid Hit " << std::endl;
00696 return;
00697 }
00698
00699 const uint32_t& detid = tkrecHit->geographicalId().rawId();
00700 if (find(ModulesToBeExcluded_.begin(),ModulesToBeExcluded_.end(),detid)!=ModulesToBeExcluded_.end()){
00701 LogTrace("SiStripMonitorTrack") << "Modules Excluded" << std::endl;
00702 return;
00703 }
00704
00705 LogTrace("SiStripMonitorTrack")
00706 <<"\n\t\tRecHit on det "<<tkrecHit->geographicalId().rawId()
00707 <<"\n\t\tRecHit in LP "<<tkrecHit->localPosition()
00708 <<"\n\t\tRecHit in GP "<<tkgeom->idToDet(tkrecHit->geographicalId())->surface().toGlobal(tkrecHit->localPosition())
00709 <<"\n\t\tRecHit trackLocal vector "<<LV.x() << " " << LV.y() << " " << LV.z() <<std::endl;
00710
00711
00712 if ( tkrecHit != NULL ){
00713 LogTrace("SiStripMonitorTrack") << "GOOD hit" << std::endl;
00714 const SiStripCluster* SiStripCluster_ = &*(tkrecHit->cluster());
00715 SiStripClusterInfo* SiStripClusterInfo_ = new SiStripClusterInfo(detid,*SiStripCluster_,es);
00716
00717 if ( clusterInfos(SiStripClusterInfo_,detid,"OnTrack", LV ) ) {
00718 vPSiStripCluster.push_back(SiStripCluster_);
00719 countOn++;
00720 }
00721 delete SiStripClusterInfo_;
00722
00723 }else{
00724 edm::LogError("SiStripMonitorTrack") << "NULL hit" << std::endl;
00725 }
00726 }
00727
00728
00729
00730 void SiStripMonitorTrack::AllClusters( const edm::EventSetup& es)
00731 {
00732
00733
00734 for ( edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter=dsv_SiStripCluster->begin(); DSViter!=dsv_SiStripCluster->end();DSViter++){
00735 uint32_t detid=DSViter->id();
00736 if (find(ModulesToBeExcluded_.begin(),ModulesToBeExcluded_.end(),detid)!=ModulesToBeExcluded_.end()) continue;
00737
00738 edm::LogInfo("SiStripMonitorTrack") << "on detid "<< detid << " N Cluster= " << DSViter->size();
00739 edmNew::DetSet<SiStripCluster>::const_iterator ClusIter = DSViter->begin();
00740 for(; ClusIter!=DSViter->end(); ClusIter++) {
00741 SiStripClusterInfo* SiStripClusterInfo_= new SiStripClusterInfo(detid,*ClusIter,es);
00742 LogDebug("SiStripMonitorTrack") << "ClusIter " << &*ClusIter << "\t "
00743 << std::find(vPSiStripCluster.begin(),vPSiStripCluster.end(),&*ClusIter)-vPSiStripCluster.begin();
00744 if (std::find(vPSiStripCluster.begin(),vPSiStripCluster.end(),&*ClusIter) == vPSiStripCluster.end()){
00745 if ( clusterInfos(SiStripClusterInfo_,detid,"OffTrack",LV) ) {
00746 countOff++;
00747 }
00748 }
00749 delete SiStripClusterInfo_;
00750 }
00751 }
00752 }
00753
00754
00755 bool SiStripMonitorTrack::clusterInfos(SiStripClusterInfo* cluster, const uint32_t& detid,std::string flag, const LocalVector LV)
00756 {
00757 LogTrace("SiStripMonitorTrack") << "\n["<<__PRETTY_FUNCTION__<<"]" << std::endl;
00758
00759 if (cluster==0) return false;
00760
00761 const edm::ParameterSet ps = conf_.getParameter<edm::ParameterSet>("ClusterConditions");
00762 if( ps.getParameter<bool>("On") &&
00763 (cluster->getSignalOverNoiseRescaledByGain() < ps.getParameter<double>("minStoN") ||
00764 cluster->getSignalOverNoiseRescaledByGain() > ps.getParameter<double>("maxStoN") ||
00765 cluster->getWidth() < ps.getParameter<double>("minWidth") ||
00766 cluster->getWidth() > ps.getParameter<double>("maxWidth") )) return false;
00767
00768
00769 int SubDet_enum = StripSubdetector(detid).subdetId()-3;
00770 int iflag =0;
00771 if (flag=="OnTrack") iflag=0;
00772 else if (flag=="OffTrack") iflag=1;
00773 NClus[SubDet_enum][iflag]++;
00774 std::stringstream ss;
00775
00776 LogTrace("SiStripMonitorTrack") << "\n["<<__PRETTY_FUNCTION__<<"]\n" << ss.str() << std::endl;
00777
00778 float cosRZ = -2;
00779 LogTrace("SiStripMonitorTrack")<< "\n\tLV " << LV.x() << " " << LV.y() << " " << LV.z() << " " << LV.mag() << std::endl;
00780 if (LV.mag()!=0){
00781 cosRZ= fabs(LV.z())/LV.mag();
00782 LogTrace("SiStripMonitorTrack")<< "\n\t cosRZ " << cosRZ << std::endl;
00783 }
00784 std::string name;
00785
00786
00787 std::pair<std::string,int32_t> SubDetAndLayer = folder_organizer.GetSubDetAndLayer(detid,flag_ring);
00788 name=flag+"_in_"+SubDetAndLayer.first;
00789 fillTrendMEs(cluster,name,cosRZ,flag);
00790 fillCapacitiveCouplingMEs(cluster,name,cosRZ,flag);
00791
00792 char rest[1024];
00793 int subdetid = ((detid>>25)&0x7);
00794 if( subdetid==3 ){
00795
00796 TIBDetId tib1 = TIBDetId(detid);
00797 sprintf(rest,"TIB__layer__%d",tib1.layer());
00798 }else if( subdetid==4){
00799
00800 TIDDetId tid1 = TIDDetId(detid);
00801 sprintf(rest,"TID__side__%d__wheel__%d",tid1.side(),tid1.wheel());
00802 }else if( subdetid==5){
00803
00804 TOBDetId tob1 = TOBDetId(detid);
00805 sprintf(rest,"TOB__layer__%d",tob1.layer());
00806 }else if( subdetid==6){
00807
00808 TECDetId tec1 = TECDetId(detid);
00809 sprintf(rest,"TEC__side__%d__wheel__%d",tec1.side(),tec1.wheel());
00810 }else{
00811
00812 edm::LogError("SiStripTkDQM|WrongInput")<<"no such subdetector type :"<<subdetid<<" no folder set!"<<std::endl;
00813 return 0;
00814 }
00815
00816 if(flag_ring){
00817 if( subdetid==4){
00818
00819 TIDDetId tid1 = TIDDetId(detid);
00820 sprintf(rest,"TID__side__%d__ring__%d",tid1.side(),tid1.ring());
00821 }else if( subdetid==6){
00822
00823 TECDetId tec1 = TECDetId(detid);
00824 sprintf(rest,"TEC__side__%d__ring__%d",tec1.side(),tec1.ring());
00825 }
00826 }
00827
00828
00829
00830 SiStripHistoId hidmanager1;
00831
00832 name= hidmanager1.createHistoLayer("","layer",rest,flag);
00833 fillTrendMEs(cluster,name,cosRZ,flag);
00834 fillCapacitiveCouplingMEs(cluster,name,cosRZ,flag);
00835
00836
00837 if(Mod_On_){
00838 if(flag=="OnTrack"){
00839 SiStripHistoId hidmanager2;
00840 name =hidmanager2.createHistoId("","det",detid);
00841 fillModMEs(cluster,name,cosRZ);
00842 }
00843 }
00844 return true;
00845 }
00846
00847
00848 void SiStripMonitorTrack::fillTrend(MonitorElement* me ,float value)
00849 {
00850 if(!me) return;
00851
00852 int option = conf_.getParameter<edm::ParameterSet>("Trending").getParameter<int32_t>("UpdateMode");
00853 if(firstEvent==-1) firstEvent = eventNb;
00854 int CurrentStep = atoi(me->getAxisTitle(1).c_str()+8);
00855 int firstEventUsed = firstEvent;
00856 int presentOverflow = (int)me->getBinEntries(me->getNbinsX()+1);
00857 if(option==2) firstEventUsed += CurrentStep * int(me->getBinEntries(me->getNbinsX()+1));
00858 else if(option==3) firstEventUsed += CurrentStep * int(me->getBinEntries(me->getNbinsX()+1)) * me->getNbinsX();
00859
00860 me->Fill((eventNb-firstEventUsed)/CurrentStep,value);
00861 if(eventNb-firstEvent<1) return;
00862
00863 if(presentOverflow == me->getBinEntries(me->getNbinsX()+1)) return;
00864 switch(option) {
00865 case 1:
00866 {
00867
00868 int NbinsX = me->getNbinsX();
00869 float entries = 0.;
00870 float content = 0.;
00871 float error = 0.;
00872 int bin = 1;
00873 int totEntries = int(me->getEntries());
00874 for(;bin<=NbinsX/2;++bin) {
00875 content = (me->getBinContent(2*bin-1) + me->getBinContent(2*bin))/2.;
00876 error = pow((me->getBinError(2*bin-1)*me->getBinError(2*bin-1)) + (me->getBinError(2*bin)*me->getBinError(2*bin)),0.5)/2.;
00877 entries = me->getBinEntries(2*bin-1) + me->getBinEntries(2*bin);
00878 me->setBinContent(bin,content*entries);
00879 me->setBinError(bin,error);
00880 me->setBinEntries(bin,entries);
00881 }
00882 for(;bin<=NbinsX+1;++bin) {
00883 me->setBinContent(bin,0);
00884 me->setBinError(bin,0);
00885 me->setBinEntries(bin,0);
00886 }
00887 me->setEntries(totEntries);
00888 char buffer[256];
00889 sprintf(buffer,"EventId/%d",CurrentStep*2);
00890 me->setAxisTitle(std::string(buffer),1);
00891 break;
00892 }
00893 case 2:
00894 {
00895
00896 int bin=1;
00897 int NbinsX = me->getNbinsX();
00898 for(;bin<=NbinsX;++bin) {
00899 me->setBinContent(bin,me->getBinContent(bin+1)*me->getBinEntries(bin+1));
00900 me->setBinError(bin,me->getBinError(bin+1));
00901 me->setBinEntries(bin,me->getBinEntries(bin+1));
00902 }
00903 break;
00904 }
00905 case 3:
00906 {
00907
00908 int NbinsX = me->getNbinsX();
00909 for(int bin=0;bin<=NbinsX;++bin) {
00910 me->setBinContent(bin,0);
00911 me->setBinError(bin,0);
00912 me->setBinEntries(bin,0);
00913 }
00914 break;
00915 }
00916 }
00917 }
00918
00919
00920 void SiStripMonitorTrack::fillModMEs(SiStripClusterInfo* cluster,TString name,float cos)
00921 {
00922 std::map<TString, ModMEs>::iterator iModME = ModMEsMap.find(name);
00923 if(iModME!=ModMEsMap.end()){
00924 fillME(iModME->second.ClusterStoN ,cluster->getSignalOverNoiseRescaledByGain());
00925 fillME(iModME->second.ClusterStoNCorr ,cluster->getSignalOverNoiseRescaledByGain()*cos);
00926 fillME(iModME->second.ClusterCharge,cluster->getCharge());
00927 fillME(iModME->second.ClusterChargeCorr,cluster->getCharge()*cos);
00928 fillME(iModME->second.ClusterWidth ,cluster->getWidth());
00929 fillME(iModME->second.ClusterPos ,cluster->getPosition());
00930
00931
00932 float PGVmax = cluster->getMaxCharge();
00933 int PGVposCounter = cluster->getFirstStrip() - cluster->getMaxPosition();
00934 for (int i= int(conf_.getParameter<edm::ParameterSet>("TProfileClusterPGV").getParameter<double>("xmin"));i<PGVposCounter;++i)
00935 fillME(iModME->second.ClusterPGV, i,0.);
00936 for (std::vector<uint8_t>::const_iterator it=cluster->getStripAmplitudes().begin();it<cluster->getStripAmplitudes().end();++it) {
00937 fillME(iModME->second.ClusterPGV, PGVposCounter++,(*it)/PGVmax);
00938 }
00939 for (int i= PGVposCounter;i<int(conf_.getParameter<edm::ParameterSet>("TProfileClusterPGV").getParameter<double>("xmax"));++i)
00940 fillME(iModME->second.ClusterPGV, i,0.);
00941
00942 }
00943 }
00944
00945
00946 void SiStripMonitorTrack::fillTrendMEs(SiStripClusterInfo* cluster,std::string name,float cos, std::string flag)
00947 {
00948 std::map<TString, LayerMEs>::iterator iLayerME = LayerMEsMap.find(name);
00949 if(iLayerME!=LayerMEsMap.end()){
00950 if(flag=="OnTrack"){
00951 fillME(iLayerME->second.ClusterStoNCorr,(cluster->getSignalOverNoiseRescaledByGain())*cos);
00952 fillTrend(iLayerME->second.ClusterStoNCorrTrend,(cluster->getSignalOverNoiseRescaledByGain())*cos);
00953 fillME(iLayerME->second.ClusterChargeCorr,cluster->getCharge()*cos);
00954 fillTrend(iLayerME->second.ClusterChargeCorrTrend,cluster->getCharge()*cos);
00955 }
00956 fillME(iLayerME->second.ClusterStoN ,cluster->getSignalOverNoiseRescaledByGain());
00957 fillTrend(iLayerME->second.ClusterStoNTrend,cluster->getSignalOverNoiseRescaledByGain());
00958 fillME(iLayerME->second.ClusterCharge,cluster->getCharge());
00959 fillTrend(iLayerME->second.ClusterChargeTrend,cluster->getCharge());
00960 fillME(iLayerME->second.ClusterNoise ,cluster->getNoiseRescaledByGain());
00961 fillTrend(iLayerME->second.ClusterNoiseTrend,cluster->getNoiseRescaledByGain());
00962 fillME(iLayerME->second.ClusterWidth ,cluster->getWidth());
00963 fillTrend(iLayerME->second.ClusterWidthTrend,cluster->getWidth());
00964 fillME(iLayerME->second.ClusterPos ,cluster->getPosition());
00965 }
00966 }
00967
00968
00969 void SiStripMonitorTrack::fillCapacitiveCouplingMEs(SiStripClusterInfo* cluster,std::string name, float cos, std::string flag) {
00970 std::map<TString, LayerMEs>::iterator iLayerME = LayerMEsMap.find(name);
00971 if(iLayerME!=LayerMEsMap.end()){
00972
00973 if( cos > 0.9 ) {
00974 LogTrace("SiStripMonitorTrack") << "\t\t Perpendicular Track, cluster center " << cluster->getMaxPosition() << std::endl;
00975
00976
00977 float chargeCentral = 0.;
00978 std::pair< float,float > chargeLeftRight;
00979
00980 if(RawDigis_On_) {
00981
00982 if(!dsv_SiStripRawDigi.failedToGet()) {
00983 if((*(dsv_SiStripRawDigi.product())).find(cluster->getDetId()) != (*(dsv_SiStripRawDigi.product())).end() ) {
00984 const edm::DetSet<SiStripRawDigi> ds_SiStripRawDigi = (*(dsv_SiStripRawDigi.product()))[cluster->getDetId()];
00985 edmNew::DetSet<SiStripCluster> ds_SiStripCluster = (*(dsv_SiStripCluster.product()))[cluster->getDetId()];
00986 LogDebug("SiStripMonitorTrack") << "RawDigis found " << ds_SiStripRawDigi.size() << std::endl;
00987 std::vector<float> chargesCLR = cluster->getRawChargeCLR(ds_SiStripRawDigi,ds_SiStripCluster,std::string("VirginRaw"));
00988 chargeCentral = chargesCLR[0];
00989 chargeLeftRight.first = chargesCLR[1];
00990 chargeLeftRight.second = chargesCLR[2];
00991 }
00992 }
00993 } else {
00994 LogDebug("SiStripMonitorTrack") << "RawDigis " << RawDigis_On_ << " take info from cluster strips" << std::endl;
00995
00996 chargeCentral = cluster->getMaxCharge();
00997 chargeLeftRight = cluster->getChargeLRFirstNeighbour();
00998 }
00999 float symmetricEta = SymEta(chargeCentral,chargeLeftRight.first,chargeLeftRight.second);
01000 float ccEstimator = symmetricEta / ( 1 + 2 * symmetricEta );
01001
01002
01003 LogTrace("SiStripMonitorTrack")
01004 <<"\n\t\t Cluster with multiplicity " << cluster->getWidth()
01005 << " in det " << cluster->getDetId()
01006 << ": Eta Function from Charge"
01007 <<"\n\t\t\t Signal = " << cluster->getCharge()
01008 <<"\n\t\t\t Noise = " << cluster->getNoiseRescaledByGain()
01009 <<"\n\t\t\t S/N = " << cluster->getSignalOverNoiseRescaledByGain()
01010 <<"\n\t\t\t Cluster Central C = " << cluster->getMaxCharge()
01011 <<"\n\t\t\t Cluster Left L = " << cluster->getChargeLRFirstNeighbour().first
01012 <<"\n\t\t\t Cluster Right R = " << cluster->getChargeLRFirstNeighbour().second
01013 <<"\n\t\t\t RawDigi Central C = " << chargeCentral
01014 <<"\n\t\t\t RawDigi Left L = " << chargeLeftRight.first
01015 <<"\n\t\t\t RawDigi Right R = " << chargeLeftRight.second
01016 <<"\n\t\t\t Max = " << cluster->getMaxCharge()
01017 <<"\n\t\t\t Pos = " << cluster->getMaxPosition()
01018 <<"\n\t\t\t 1st = " << cluster->getFirstStrip()
01019 <<"\n\t\t\t Symmetric Eta = " << symmetricEta
01020 <<"\n\t\t\t CC Estimator = " << ccEstimator
01021 << std::endl;
01022 for (std::vector<uint8_t>::const_iterator it=cluster->getStripAmplitudes().begin();it<cluster->getStripAmplitudes().end();++it) {
01023 LogTrace("SiStripMonitorTrack")
01024 <<"\t\t\t " << (short)(*it) << std::endl;
01025 }
01026
01027
01028
01029 fillME(iLayerME->second.ClusterSymmEtaCC , symmetricEta);
01030 fillTrend(iLayerME->second.ClusterSymmEtaCCTrend, symmetricEta);
01031
01032 if(CCAnalysis_On_) {
01033 fillME(iLayerME->second.ClusterWidthCC, cluster->getWidth() );
01034 fillME(iLayerME->second.ClusterEstimatorCC , ccEstimator );
01035 }
01036
01037
01038 }
01039 }
01040 }
01041
01042
01043
01044 float SiStripMonitorTrack::SymEta( float clusterCentralCharge, float clusterLeftCharge, float clusterRightCharge){
01045 float symeta = ( clusterLeftCharge + clusterRightCharge )/( 2 * clusterCentralCharge );
01046 return symeta;
01047 }